Changeset 289 for trunk/src/gfx/skeletal_mesh.cc
- Timestamp:
- 07/23/14 20:36:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gfx/skeletal_mesh.cc
r288 r289 18 18 m_pntdata.assign( (const md5_vtx_pnt*)pnt_chan->data, pnt_chan->count ); 19 19 m_bone_offset.resize( bones->get_count() ); 20 m_transform.resize( bones->get_count() ); 21 20 22 for ( uint32 i = 0; i < bones->get_count(); ++i ) 21 23 { … … 32 34 { 33 35 skeletal_animation_entry * anim = (skeletal_animation_entry*)a_anim; 34 float frame_duration = 1000.f / (float)anim->get_frame_rate(); 35 float anim_duration = frame_duration * anim->get_duration(); 36 float new_time = fmodf( (float)a_anim_time, anim_duration ); 37 anim->update_skeleton( m_transform.data(), new_time * 0.001f ); 38 39 //m_mesh_data->apply( m_transform.data() ); 36 anim->update_skeleton( m_transform.data(), (float)a_anim_time ); 40 37 { 41 38 size_t skeleton_size = m_bone_offset.size(); … … 72 69 } 73 70 71 72 void nv::skeletal_animation_entry::update_skeleton( transform* skeleton, float time ) const 73 { 74 float frame_duration = 1000.f / (float)m_node_data->get_frame_rate(); 75 float anim_duration = frame_duration * m_node_data->get_duration(); 76 float new_time = fmodf( time, anim_duration ) * 0.001f; 77 78 float frame_num = new_time * m_node_data->get_frame_rate(); 79 for ( size_t i = 0; i < m_node_data->get_count(); ++i ) 80 { 81 skeleton[i] = m_node_data->get_node(i)->data->get_transform( frame_num ); 82 } 83 } 84 85 86 74 87 nv::skeletal_mesh::~skeletal_mesh() 75 88 { … … 81 94 if ( a_anim != nullptr ) 82 95 { 83 skeletal_animation_entry * anim = (skeletal_animation_entry*)(a_anim);84 m_transform.resize( anim->get_num_joints() );85 96 update_animation( a_anim, 0 ); 86 97 }
Note: See TracChangeset
for help on using the changeset viewer.