Index: trunk/src/gfx/keyframed_mesh.cc
===================================================================
--- trunk/src/gfx/keyframed_mesh.cc	(revision 287)
+++ trunk/src/gfx/keyframed_mesh.cc	(revision 288)
@@ -19,11 +19,7 @@
 	, m_mesh_data( a_data )
 	, m_tag_map( a_tag_map )
-	, m_start_frame( false )
-	, m_stop_frame( false )
 	, m_last_frame( 0 )
 	, m_next_frame( 0 )
-	, m_fps( 0 )
 	, m_interpolation( 0.0f )
-	, m_looping( false )
 	, m_active( false )
 {
@@ -56,16 +52,4 @@
 }
 
-void keyframed_mesh::setup_animation( uint32 start, uint32 count, uint32 fps, bool loop )
-{
-	m_start_frame   = start;
-	m_stop_frame    = start+count-1;
-	m_looping       = loop;
-	m_fps           = fps;
-	m_active        = count > 1;
-	m_last_frame    = start;
-	m_next_frame    = (count > 1 ? start + 1 : start );
-	m_interpolation = 0.0f;
-}
-
 void nv::keyframed_mesh::set_frame( uint32 frame )
 {
@@ -76,31 +60,29 @@
 }
 
-void nv::keyframed_mesh::update_animation( animation_entry*, uint32 a_anim_time )
+void nv::keyframed_mesh::update_animation( animation_entry* anim, uint32 a_anim_time )
 {
 	if ( m_active )
 	{
-		uint32 f_diff = (m_stop_frame - m_start_frame);
-		float  f_time = 1000 / (float)m_fps;
-		float f_max   = ( m_looping ? ( f_diff + 1 ) : f_diff ) * f_time;
-		uint32 time   = a_anim_time;
-		if ( time >= f_max )
+		float tick_time = ( (float)a_anim_time * 0.001f ) * anim->get_frame_rate();
+		float duration  = anim->is_looping() ? anim->get_duration() + 1.0f : anim->get_duration();
+		if ( tick_time >= duration )
 		{
-			if ( m_looping )
+			if ( anim->is_looping() )
 			{
-				time = time % static_cast< uint32 >( f_max );
+				tick_time = fmodf( tick_time, duration );
 			}
 			else
 			{
 				m_active     = false;
-				m_last_frame = m_stop_frame;
-				m_next_frame = m_stop_frame;
+				m_last_frame = (uint32)anim->get_end();
+				m_next_frame = m_last_frame;
+				m_interpolation = 0.0f;
+				return;
 			}
 		}
-		float f_pos   = time / f_time;
-
-		m_last_frame    = (uint32)glm::floor( f_pos ) + m_start_frame;
+		m_last_frame    = (uint32)( glm::floor( tick_time ) + anim->get_start() );
 		m_next_frame    = m_last_frame + 1;
-		if ( m_next_frame > m_stop_frame ) m_next_frame = m_start_frame;
-		m_interpolation = f_pos - glm::floor( f_pos );
+		if ( m_next_frame > (uint32)anim->get_end() ) m_next_frame = (uint32)anim->get_start();
+		m_interpolation = tick_time - glm::floor( tick_time );
 	}
 }
@@ -121,7 +103,8 @@
 	if ( a_anim )
 	{
-		keyframed_animation_entry * anim = down_cast<keyframed_animation_entry>(a_anim);
-		m_active = true;
-		setup_animation( anim->m_start, anim->m_frames, anim->m_fps, anim->m_looping );
+		m_active        = true;
+		m_last_frame    = 0;
+		m_next_frame    = 0;
+		m_interpolation = 0.0f;
 	}
 	else
Index: trunk/src/gfx/skeletal_mesh.cc
===================================================================
--- trunk/src/gfx/skeletal_mesh.cc	(revision 287)
+++ trunk/src/gfx/skeletal_mesh.cc	(revision 288)
@@ -33,7 +33,7 @@
 		skeletal_animation_entry * anim = (skeletal_animation_entry*)a_anim;
 		float frame_duration = 1000.f / (float)anim->get_frame_rate();
-		uint32 anim_duration = uint32( frame_duration * (float)anim->get_frame_count() );
-		uint32 new_time = a_anim_time % anim_duration;
-		anim->update_skeleton( m_transform.data(), (float)new_time * 0.001f );
+		float anim_duration = frame_duration * anim->get_duration();
+		float new_time = fmodf( (float)a_anim_time, anim_duration );
+		anim->update_skeleton( m_transform.data(), new_time * 0.001f );
 
 		//m_mesh_data->apply( m_transform.data() );
@@ -87,15 +87,10 @@
 }
 
-
-nv::skeletal_animation_entry_gpu::skeletal_animation_entry_gpu( const std::string& name, const mesh_nodes_data* anim, bool a_looping ) 
-	: animation_entry( name )
-	, m_node_data( anim )
-{
-	uint32 node_count = m_node_data->get_count();
-
+void nv::skeletal_animation_entry_gpu::initialize()
+{
 	m_prepared  = false;
-	m_looping   = a_looping;
 	m_children  = nullptr;
 	m_offsets   = nullptr;
+	uint32 node_count = m_node_data->get_count();
 	m_bone_ids  = new sint16[ node_count ];
 
