Changeset 451 for trunk


Ignore:
Timestamp:
07/30/15 19:47:02 (10 years ago)
Author:
epyon
Message:
  • math library started
Location:
trunk
Files:
6 added
13 edited

Legend:

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

    r410 r451  
    5050                        vec3 vb = get_arcball_vector( nposition );
    5151
    52                         m_angle = glm::acos( glm::min( 1.0f, glm::dot( va, vb ) ) );
     52                        m_angle = math::acos( glm::min( 1.0f, glm::dot( va, vb ) ) );
    5353                        m_axis  = glm::cross( va, vb );
    5454                        m_last  = nposition;
  • trunk/nv/core/random.hh

    r443 r451  
    7878
    7979                template < typename T >
    80                 tvec2<T> range( tvec2<T> min, tvec2<T> max )
    81                 {
    82                         return tvec2<T>(
     80                math::tvec2<T> range( math::tvec2<T> min, math::tvec2<T> max )
     81                {
     82                        return math::tvec2<T>(
    8383                                range_impl( min.x, max.x, is_floating_point<T>() ),
    8484                                range_impl( min.y, max.y, is_floating_point<T>() )
     
    8787
    8888                template < typename T >
    89                 tvec3<T> range( tvec3<T> min, tvec3<T> max )
    90                 {
    91                         return tvec3<T>(
     89                math::tvec3<T> range( math::tvec3<T> min, math::tvec3<T> max )
     90                {
     91                        return math::tvec3<T>(
    9292                                range_impl( min.x, max.x, is_floating_point<T>() ),
    9393                                range_impl( min.y, max.y, is_floating_point<T>() ),
     
    9797
    9898                template < typename T >
    99                 tvec4<T> range( tvec4<T> min, tvec4<T> max )
    100                 {
    101                         return tvec4<T>(
     99                math::tvec4<T> range( math::tvec4<T> min, math::tvec4<T> max )
     100                {
     101                        return math::tvec4<T>(
    102102                                range_impl( min.x, max.x, is_floating_point<T>() ),
    103103                                range_impl( min.y, max.y, is_floating_point<T>() ),
  • trunk/nv/interface/camera.hh

    r397 r451  
    2626                void set_lookat( const vec3& eye, const vec3& focus, const vec3& up )
    2727                {
    28                         m_view      = glm::lookAt( eye, focus, up );
     28                        m_view      = math::look_at( eye, focus, up );
    2929                        m_position  = eye;
    3030                        m_direction = glm::normalize( focus - eye );
     
    3333                void set_perspective( f32 fov, f32 aspect, f32 near, f32 far )
    3434                {
    35                         m_projection = glm::perspective( glm::radians( fov ), aspect, near, far );
     35                        m_projection = math::perspective( glm::radians( fov ), aspect, near, far );
    3636                }
    3737                void set_ortho( f32 left, f32 right, f32 bottom, f32 top, f32 near = -1.0f, f32 far = 1.0f )
    3838                {
    39                         m_projection = glm::ortho( left, right, bottom, top, near, far );
     39                        m_projection = math::ortho( left, right, bottom, top, near, far );
    4040                }
    4141                const mat4& get_projection() const
     
    8181                mat4 get_view_inv()   const { return glm::inverse( get_view() ); }
    8282                mat4 get_model_inv()  const { return glm::inverse( get_model() ); }
    83                 mat3 get_normal()     const { return glm::transpose(glm::inverse(glm::mat3( get_modelview() ) ) ); }
     83                mat3 get_normal()     const { return glm::transpose(glm::inverse( mat3( get_modelview() ) ) ); }
    8484        protected:
    8585                mat4   m_model;
  • trunk/nv/interface/interpolation_raw.hh

    r419 r451  
    6868                        {
    6969                        case slot::TIME:        return mat4();
    70                         case slot::TRANSLATION: return glm::translate( mat4(), make_vec3( data ) );
     70                        case slot::TRANSLATION: return math::translate( mat4(), make_vec3( data ) );
    7171                        case slot::ROTATION:    return mat4_cast( make_quat_fixed( data ) );
    72                         case slot::SCALE:       return glm::scale( mat4(),make_vec3( data ) );
     72                        case slot::SCALE:       return math::scale( mat4(),make_vec3( data ) );
    7373                        case slot::TFORM:       return transform( make_vec3( data ), make_quat_fixed( data + 3 ) ).extract();
    7474                        default:
     
    8888                                case slot::TIME:     break;
    8989                                case slot::TRANSLATION:
    90                                         translation = glm::translate( translation,make_vec3( data + offset ) ); break;
     90                                        translation = math::translate( translation,make_vec3( data + offset ) ); break;
    9191                                case slot::ROTATION:
    9292                                        rotation = mat4_cast( make_quat_fixed( data + offset ) ); break;
    9393                                case slot::SCALE:   
    94                                         scale    = glm::scale( mat4(),make_vec3( data + offset ) ); break;
     94                                        scale    = math::scale( mat4(),make_vec3( data + offset ) ); break;
    9595                                case slot::TFORM:    return transform( make_vec3( data + offset ), make_quat_fixed( data + offset + 3 ) ).extract();
    9696                                default:
  • trunk/nv/stl/handle.hh

    r440 r451  
    165165                T* insert( handle h )
    166166                {
     167                        NV_ASSERT( !exists( h ), "Reinserting handle!" );
    167168                        resize_indexes_to( index_type( h.index() ) );
    168169                        m_indexes[ h.index() ] = index_type( m_data.size() );
  • trunk/nv/stl/math.hh

    r417 r451  
    1111
    1212#include <nv/common.hh>
    13 
    14 #if NV_COMPILER == NV_GNUC
    15 #pragma GCC system_header
    16 #elif NV_COMPILER == NV_CLANG
    17 #pragma clang system_header
    18 #endif
    19 
    20 #include <glm/glm.hpp>
    21 #include <glm/gtc/matrix_transform.hpp>
    22 #include <glm/gtc/type_ptr.hpp>
    23 #include <glm/gtc/quaternion.hpp>
    24 #include <glm/gtx/vector_angle.hpp>
    25 
    26 namespace nv
    27 {
    28 #if 0
    29         template < typename T > using tvec2 = ::glm::detail::tvec2<T, glm::precision::highp>;
    30         template < typename T > using tvec3 = ::glm::detail::tvec3<T, glm::precision::highp>;
    31         template < typename T > using tvec4 = ::glm::detail::tvec4<T, glm::precision::highp>;
    32         template < typename T > using tmat2 = ::glm::detail::tmat2x2<T, glm::precision::highp>;
    33         template < typename T > using tmat3 = ::glm::detail::tmat3x3<T, glm::precision::highp>;
    34         template < typename T > using tmat4 = ::glm::detail::tmat4x4<T, glm::precision::highp>;
    35         template < typename T > using tquat = ::glm::detail::tmat4x4<T, glm::precision::highp>;
    36 #else
    37         template < typename T > using tvec2 = ::glm::tvec2<T>;
    38         template < typename T > using tvec3 = ::glm::tvec3<T>;
    39         template < typename T > using tvec4 = ::glm::tvec4<T>;
    40         template < typename T > using tmat2 = ::glm::tmat2x2<T>;
    41         template < typename T > using tmat3 = ::glm::tmat3x3<T>;
    42         template < typename T > using tmat4 = ::glm::tmat4x4<T>;
    43         template < typename T > using tquat = ::glm::tmat4x4<T>;
    44 #endif
    45 
    46         using ::glm::mat3_cast;
    47         using ::glm::mat4_cast;
    48         using ::glm::quat_cast;
    49         using ::glm::make_vec2;
    50         using ::glm::make_vec3;
    51         using ::glm::make_vec4;
    52         using ::glm::make_mat2;
    53         using ::glm::make_mat3;
    54         using ::glm::make_mat4;
    55 
    56         typedef tvec2<sint8> i8vec2;
    57         typedef tvec3<sint8> i8vec3;
    58         typedef tvec4<sint8> i8vec4;
    59 
    60         typedef tvec2<sint16> i16vec2;
    61         typedef tvec3<sint16> i16vec3;
    62         typedef tvec4<sint16> i16vec4;
    63 
    64         typedef tvec2<uint8> u8vec2;
    65         typedef tvec3<uint8> u8vec3;
    66         typedef tvec4<uint8> u8vec4;
    67 
    68         typedef tvec2< float > vec2;
    69         typedef tvec3< float > vec3;
    70         typedef tvec4< float > vec4;
    71 
    72         typedef tvec2< int > ivec2;
    73         typedef tvec3< int > ivec3;
    74         typedef tvec4< int > ivec4;
    75 
    76         typedef tmat2< float > mat2;
    77         typedef tmat3< float > mat3;
    78         typedef tmat4< float > mat4;
    79 
    80         typedef glm::quat quat;
     13#include <nv/stl/math/common.hh>
     14#include <nv/stl/math/constants.hh>
     15#include <nv/stl/math/matrix_transform.hh>
     16#include <nv/stl/math/cast.hh>
     17
     18namespace nv {
    8119
    8220        template <typename T>
     
    8927
    9028        template <typename T>
    91         struct datatype_traits< tvec2<T> >
    92         {
    93                 typedef tvec2<T> type;
     29        struct datatype_traits< math::tvec2<T> >
     30        {
     31                typedef math::tvec2<T> type;
    9432                typedef typename type::value_type base_type;
    9533                static const size_t size = 2;
     
    9735
    9836        template <typename T>
    99         struct datatype_traits< tvec3<T> >
    100         {
    101                 typedef tvec3<T> type;
     37        struct datatype_traits< math::tvec3<T> >
     38        {
     39                typedef math::tvec3<T> type;
    10240                typedef typename type::value_type base_type;
    10341                static const size_t size = 3;
     
    10543
    10644        template <typename T>
    107         struct datatype_traits< tvec4<T> >
    108         {
    109                 typedef tvec4<T> type;
     45        struct datatype_traits< math::tvec4<T> >
     46        {
     47                typedef math::tvec4<T> type;
    11048                typedef typename type::value_type base_type;
    11149                static const size_t size = 4;
     
    282220
    283221        template <typename T>
    284         tvec3<T> normalize_safe(
    285                 const tvec3<T>& x,
    286                 const tvec3<T>& def = vec3()
     222        math::tvec3<T> normalize_safe(
     223                const math::tvec3<T>& x,
     224                const math::tvec3<T>& def = vec3()
    287225        )
    288226        {
    289                 typename tvec3<T>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z;
     227                typename math::tvec3<T>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z;
    290228                return ( sqr > 0 ? x * glm::inversesqrt(sqr) : def );
    291229        }
  • trunk/nv/stl/range.hh

    r406 r451  
    6666                template < typename T >
    6767                class range2d_iterator_base
    68                         : public forward_iterator_base< tvec2<T> >
    69                 {
    70                 public:
    71                         typedef forward_iterator_base< tvec2<T> > base_class;
    72 
    73                         range2d_iterator_base( tvec2<T> value, T min, T max )
    74                                 : forward_iterator_base< tvec2<T> >( value ), m_min(min), m_max(max) {}
     68                        : public forward_iterator_base< math::tvec2<T> >
     69                {
     70                public:
     71                        typedef forward_iterator_base< math::tvec2<T> > base_class;
     72
     73                        range2d_iterator_base( math::tvec2<T> value, T min, T max )
     74                                : forward_iterator_base< math::tvec2<T> >( value ), m_min(min), m_max(max) {}
    7575                        range2d_iterator_base& operator++ ()
    7676                        {
  • trunk/src/core/random.cc

    r443 r451  
    110110nv::vec2 nv::random::precise_unit_vec2()
    111111{
    112         float angle = frand( glm::pi<float>() * 2.f );
    113         return vec2( glm::cos( angle ), glm::sin( angle ) );
     112        f32 angle = frand( math::pi<f32>() * 2.f );
     113        return vec2( math::cos( angle ), math::sin( angle ) );
    114114}
    115115
    116116nv::vec3 nv::random::precise_unit_vec3()
    117117{
    118         float cos_theta = frange( -1.0f, 1.0f );
    119         float sin_theta = glm::sqrt( 1.0f - cos_theta * cos_theta );
    120         float phi       = frand( 2 * glm::pi<float>() );
     118        f32 cos_theta = frange( -1.0f, 1.0f );
     119        f32 sin_theta = math::sqrt( 1.0f - cos_theta * cos_theta );
     120        f32 phi       = frand( 2 * math::pi<f32>() );
    121121        return vec3(
    122                 sin_theta * glm::sin(phi),
    123                 sin_theta * glm::cos(phi),
     122                sin_theta * math::sin(phi),
     123                sin_theta * math::cos(phi),
    124124                cos_theta
    125125                );
     
    128128nv::vec2 nv::random::fast_disk_point()
    129129{
    130         float r1 = frand();
    131         float r2 = frand();
     130        f32 r1 = frand();
     131        f32 r2 = frand();
    132132        if ( r1 > r2 ) swap( r1, r2 );
    133         float rf = 2*glm::pi<float>()*(r1/r2);
    134         return vec2( r2*glm::cos( rf ), r2*glm::sin( rf ) );
     133        f32 rf = 2* math::pi<f32>()*(r1/r2);
     134        return vec2( r2*math::cos( rf ), r2*math::sin( rf ) );
    135135}
    136136
    137137nv::vec2 nv::random::precise_disk_point()
    138138{
    139         float r = glm::sqrt( frand() );
    140         float rangle = frand( glm::pi<float>() );
    141         return vec2( r*glm::cos( rangle ), r*glm::sin( rangle ) );
     139        f32 r = math::sqrt( frand() );
     140        f32 rangle = frand( math::pi<f32>() );
     141        return vec2( r*math::cos( rangle ), r*math::sin( rangle ) );
    142142}
    143143
    144144nv::vec3 nv::random::fast_sphere_point()
    145145{
    146         float rad     = frand();
    147         float pi      = glm::pi<float>();
    148         float phi     = glm::asin( frange( -1.0f, 1.0f ) ) + pi*.5f;
    149         float theta   = frange( 0.0f, 2 * glm::pi<float>() );
    150         float sin_phi = glm::sin( phi );
     146        f32 rad     = frand();
     147        f32 pi      = math::pi<f32>();
     148        f32 phi     = math::asin( frange( -1.0f, 1.0f ) ) + pi*.5f;
     149        f32 theta   = frange( 0.0f, 2 * math::pi<f32>() );
     150        f32 sin_phi = math::sin( phi );
    151151        return vec3(
    152                 rad * glm::cos(theta) * sin_phi,
    153                 rad * glm::sin(theta) * sin_phi,
    154                 rad * glm::cos(phi)
     152                rad * math::cos(theta) * sin_phi,
     153                rad * math::sin(theta) * sin_phi,
     154                rad * math::cos(phi)
    155155        );
    156156}
     
    158158nv::vec3 nv::random::precise_sphere_point()
    159159{
    160         float radius = glm::pow( frand(), 1.f/3.f );
    161         float cos_theta = frange( -1.0f, 1.0f );
    162         float sin_theta = glm::sqrt( 1.0f - cos_theta * cos_theta );
    163         float phi       = frange( 0.0f, 2 * glm::pi<float>() );
     160        f32 radius = math::pow( frand(), 1.f/3.f );
     161        f32 cos_theta = frange( -1.0f, 1.0f );
     162        f32 sin_theta = math::sqrt( 1.0f - cos_theta * cos_theta );
     163        f32 phi       = frange( 0.0f, 2 * math::pi<f32>() );
    164164        return vec3(
    165                 radius * sin_theta * glm::sin(phi),
    166                 radius * sin_theta * glm::cos(phi),
     165                radius * sin_theta * math::sin(phi),
     166                radius * sin_theta * math::cos(phi),
    167167                radius * cos_theta
    168168                );
     
    199199}
    200200
    201 nv::vec2 nv::random::fast_hollow_disk_point( float iradius, float oradius )
    202 {
    203         float idist2 = iradius * iradius;
    204         float odist2 = oradius * oradius;
    205         float rdist  = glm::sqrt( frange( idist2, odist2 ) );
     201nv::vec2 nv::random::fast_hollow_disk_point( f32 iradius, f32 oradius )
     202{
     203        f32 idist2 = iradius * iradius;
     204        f32 odist2 = oradius * oradius;
     205        f32 rdist  = math::sqrt( frange( idist2, odist2 ) );
    206206        return rdist * precise_unit_vec2();
    207207}
    208208
    209 nv::vec2 nv::random::precise_hollow_disk_point( float iradius, float oradius )
     209nv::vec2 nv::random::precise_hollow_disk_point( f32 iradius, f32 oradius )
    210210{
    211211        return fast_hollow_disk_point( iradius, oradius );
    212212}
    213213
    214 nv::vec3 nv::random::fast_hollow_sphere_point( float iradius, float oradius )
    215 {
    216         float idist3 = iradius * iradius * iradius;
    217         float odist3 = oradius * oradius * oradius;
    218         float rdist  = glm::pow( frange( idist3, odist3 ), 1.f/3.f );
     214nv::vec3 nv::random::fast_hollow_sphere_point( f32 iradius, f32 oradius )
     215{
     216        f32 idist3 = iradius * iradius * iradius;
     217        f32 odist3 = oradius * oradius * oradius;
     218        f32 rdist  = math::pow( frange( idist3, odist3 ), 1.f/3.f );
    219219        return rdist * precise_unit_vec3();
    220220}
    221221
    222 nv::vec3 nv::random::precise_hollow_sphere_point( float iradius, float oradius )
     222nv::vec3 nv::random::precise_hollow_sphere_point( f32 iradius, f32 oradius )
    223223{
    224224        return fast_hollow_sphere_point( iradius, oradius );
     
    232232        vec2 opoint2    = opoint * opoint;
    233233        vec2 odir       = glm::normalize( opoint );
    234         float odist2    = opoint2.x + opoint2.y;
    235 
    236         float low    = iradii2.y * opoint2.x + iradii2.x * opoint2.y;
    237         float idist2 = ((iradii2.x * iradii2.y) / low ) * odist2;
    238 
    239         float rdist     = glm::sqrt( frange( idist2, odist2 ) );
     234        f32 odist2    = opoint2.x + opoint2.y;
     235
     236        f32 low    = iradii2.y * opoint2.x + iradii2.x * opoint2.y;
     237        f32 idist2 = ((iradii2.x * iradii2.y) / low ) * odist2;
     238
     239        f32 rdist     = math::sqrt( frange( idist2, odist2 ) );
    240240        return odir * rdist;   
    241241}
     
    252252        vec3 opoint2    = opoint * opoint;
    253253        vec3 odir       = glm::normalize( opoint );
    254         float odist2    = opoint2.x + opoint2.y + opoint2.z;
    255 
    256         float low    =
     254        f32 odist2    = opoint2.x + opoint2.y + opoint2.z;
     255
     256        f32 low    =
    257257                iradii2.y * iradii2.z * opoint2.x +
    258258                iradii2.x * iradii2.z * opoint2.y +
    259259                iradii2.x * iradii2.y * opoint2.z;
    260         float idist2 = ((iradii2.x * iradii2.y * iradii2.z) / low ) * odist2;
    261 
    262         float odist3 = odist2 * glm::sqrt( odist2 );
    263         float idist3 = idist2 * glm::sqrt( idist2 );
    264 
    265         float rdist     = glm::pow( frange( idist3, odist3 ), 1.f/3.f );
     260        f32 idist2 = ((iradii2.x * iradii2.y * iradii2.z) / low ) * odist2;
     261
     262        f32 odist3 = odist2 * math::sqrt( odist2 );
     263        f32 idist3 = idist2 * math::sqrt( idist2 );
     264
     265        f32 rdist     = math::pow( frange( idist3, odist3 ), 1.f/3.f );
    266266        return odir * rdist;   
    267267}
  • trunk/src/engine/particle_engine.cc

    r439 r451  
    231231        datap->plane_normal = normalize_safe( datap->plane_normal, vec3(0.0f,1.0f,0.0f) );
    232232        datap->bounce       = table->get<float>("bounce", 0.0f );
    233         datap->distance     = -glm::dot( datap->plane_normal, datap->plane_point ) / glm::sqrt(glm::dot( datap->plane_normal, datap->plane_normal ) );
     233        datap->distance     = -glm::dot( datap->plane_normal, datap->plane_point ) / math::sqrt(glm::dot( datap->plane_normal, datap->plane_normal ) );
    234234        return true;
    235235}
     
    411411                                edata.dir          = glm::normalize( element.get<vec3>("direction", vec3(0,1,0) ) );
    412412                               
    413                                 edata.odir = glm::vec3( 0, 0, 1 );
     413                                edata.odir = vec3( 0, 0, 1 );
    414414                                if ( edata.dir != vec3( 0, 1, 0 ) && edata.dir != vec3( 0, -1, 0 ) )
    415415                                        edata.odir = glm::normalize( glm::cross( edata.dir, vec3( 0, 1, 0 ) ) );                edata.cdir = glm::cross( edata.dir, edata.odir );
     
    750750                                        {
    751751                                                float emission_angle = glm::radians( edata.angle );
    752                                                 float cos_theta = r.frange( glm::cos( emission_angle ), 1.0f );
    753                                                 float sin_theta = glm::sqrt(1.0f - cos_theta * cos_theta );
    754                                                 float phi       = r.frange( 0.0f, 2*glm::pi<float>() );
     752                                                float cos_theta = r.frange( math::cos( emission_angle ), 1.0f );
     753                                                float sin_theta = math::sqrt(1.0f - cos_theta * cos_theta );
     754                                                float phi       = r.frange( 0.0f, 2* math::pi<float>() );
    755755                                                pinfo.velocity  = orient *
    756                                                         ( edata.odir * ( glm::cos(phi) * sin_theta ) +
    757                                                         edata.cdir * ( glm::sin(phi)*sin_theta ) +
     756                                                        ( edata.odir * ( math::cos(phi) * sin_theta ) +
     757                                                        edata.cdir * ( math::sin(phi)*sin_theta ) +
    758758                                                        edata.dir  * cos_theta );
    759759                                        }
  • trunk/src/formats/assimp_loader.cc

    r432 r451  
    139139                        vec2 s = assimp_st_cast( mesh->mTextureCoords[0][i] );
    140140
    141                         glm::vec3 t_i = glm::normalize( t - n * glm::dot( n, t ) );
     141                        vec3 t_i = glm::normalize( t - n * glm::dot( n, t ) );
    142142                        float det = ( glm::dot( glm::cross( n, t ), b ) );
    143143                        det = ( det < 0.0f ? -1.0f : 1.0f );
     
    440440//      if ( node->mNumScalingKeys > 0 )
    441441//      {
    442 //              nv::vec3 scale_vec0 = assimp_vec3_cast( node->mScalingKeys[0].mValue );
    443 //              float scale_value   = glm::length( glm::abs( scale_vec0 - nv::vec3(1,1,1) ) );
     442//              vec3 scale_vec0 = assimp_vec3_cast( node->mScalingKeys[0].mValue );
     443//              float scale_value   = glm::length( math::abs( scale_vec0 - vec3(1,1,1) ) );
    444444//              if ( node->mNumScalingKeys > 1 || scale_value > 0.001 )
    445445//              {
  • trunk/src/formats/md3_loader.cc

    r431 r451  
    240240        if ( !s_normal_ready )
    241241        {
    242                 float pi      = glm::pi<float>();
     242                float pi      = math::pi<float>();
    243243                float convert = (2 * pi) / 255.0f;
    244244                int n = 0;
     
    246246                {
    247247                        float flat    = lat * convert;
    248                         float sin_lat = glm::sin( flat );
    249                         float cos_lat = glm::cos( flat );
     248                        float sin_lat = math::sin( flat );
     249                        float cos_lat = math::cos( flat );
    250250                        for ( int lng = 0; lng < 256; ++lng, ++n )
    251251                        {
    252252                                float flng    = lng * convert;
    253                                 float sin_lng = glm::sin( flng );
    254                                 float cos_lng = glm::cos( flng );
     253                                float sin_lng = math::sin( flng );
     254                                float cos_lng = math::cos( flng );
    255255                                s_normal_cache[n].x = cos_lat * sin_lng;
    256256//                              s_normal_cache[n].y = sin_lat * sin_lng;
  • trunk/src/gfx/keyframed_mesh.cc

    r430 r451  
    9393                        }
    9494                }
    95                 m_last_frame    = static_cast<uint32>( glm::floor( tick_time ) + anim->get_start() );
     95                m_last_frame    = static_cast<uint32>( math::floor( tick_time ) + anim->get_start() );
    9696                m_next_frame    = m_last_frame + 1;
    9797                if ( m_next_frame > static_cast<uint32>( anim->get_end() ) ) m_next_frame = static_cast<uint32>( anim->get_start() );
    98                 m_interpolation = tick_time - glm::floor( tick_time );
     98                m_interpolation = tick_time - math::floor( tick_time );
    9999        }
    100100}
  • trunk/src/lua/lua_glm.cc

    r449 r451  
    5656        static inline T unit() { return T( 1, 1, 1 ); }
    5757        static inline T construct( lua_State* L, int index ) {
    58                 typedef nv::tvec2<typename T::value_type> vec2;
     58                typedef nv::math::tvec2<typename T::value_type> vec2;
    5959                if ( lua_type( L, index ) == LUA_TUSERDATA )
    6060                {
     
    7777        static inline T unit() { return T( 1, 1, 1, 1 ); }
    7878        static inline T construct( lua_State* L, int index ) {
    79                 typedef nv::tvec2<typename T::value_type> vec2;
    80                 typedef nv::tvec3<typename T::value_type> vec3;
     79                typedef nv::math::tvec2<typename T::value_type> vec2;
     80                typedef nv::math::tvec3<typename T::value_type> vec3;
    8181                if ( lua_type( L, index ) == LUA_TUSERDATA )
    8282                {
     
    242242        {
    243243                switch (len) {
    244                 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;
    245                 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;
    246                 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;
     244                case 2 : push_vec( L, nv::math::tvec2<typename T::value_type>( (*v)[nlua_swizzel_lookup[key[0]]], (*v)[nlua_swizzel_lookup[key[1]]] ) ); return 1;
     245                case 3 : push_vec( L, nv::math::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;
     246                case 4 : push_vec( L, nv::math::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;
    247247                default: break;
    248248                }
     
    258258int nlua_vec_newindex( lua_State* L )
    259259{
    260         typedef nv::tvec2<typename T::value_type> vec2;
    261         typedef nv::tvec3<typename T::value_type> vec3;
    262         typedef nv::tvec4<typename T::value_type> vec4;
     260        typedef nv::math::tvec2<typename T::value_type> vec2;
     261        typedef nv::math::tvec3<typename T::value_type> vec3;
     262        typedef nv::math::tvec4<typename T::value_type> vec4;
    263263
    264264        T* v = to_pvec<T>( L, 1 );
Note: See TracChangeset for help on using the changeset viewer.