Changeset 290 for trunk/src/gfx


Ignore:
Timestamp:
07/24/14 00:54:34 (11 years ago)
Author:
epyon
Message:
  • proper support for partial timeline animation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gfx/skeletal_mesh.cc

    r289 r290  
    122122void nv::skeletal_animation_entry_gpu::update_skeleton( mat4* data, uint32 time ) const
    123123{
    124         float tick_time = ( time * 0.001f ) * m_node_data->get_frame_rate();
    125         float anim_time = fmodf( tick_time, m_node_data->get_duration() );
     124        float tick_time = ( time * 0.001f ) * m_frame_rate;
     125        float anim_time = m_start;
     126        if ( m_duration > 0.0f ) anim_time += fmodf( tick_time, m_duration );
    126127
    127128        if ( !m_node_data->is_flat() )
     
    224225                skeletal_animation_entry_gpu * anim = (skeletal_animation_entry_gpu*)(a_anim);
    225226                anim->prepare( m_bone_data );
    226                 update_animation( a_anim, 0 );
     227                update_animation( a_anim, uint32( anim->get_start() * 1000.f * anim->get_frame_rate() * 1000 ) );
    227228        }
    228229}
     
    240241{
    241242        if ( m_bone_data )
    242                 a_program->set_uniform_array( "nv_m_bones", m_transform, m_bone_data->get_count() );
     243                a_program->set_opt_uniform_array( "nv_m_bones", m_transform, m_bone_data->get_count() );
    243244}
    244245
    245246nv::transform nv::skeletal_mesh_gpu::get_node_transform( uint32 node_id ) const
    246247{
     248        if ( node_id == 0 ) return transform();
    247249        return transform( m_transform[ node_id ] );
    248250}
Note: See TracChangeset for help on using the changeset viewer.