Changeset 470 for trunk/src/gfx/mesh_creator.cc
- Timestamp:
- 09/17/15 17:19:14 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gfx/mesh_creator.cc
r458 r470 9 9 #include "nv/interface/data_channel_access.hh" 10 10 11 #include "nv/core/logging.hh" 12 11 13 struct nv_key_transform { nv::transform tform; }; 12 14 … … 16 18 merge_keys(); 17 19 uint32 max_frames = 0; 18 for ( auto keys : m_data->m_data ) 19 { 20 21 nv::vector< sint16 > ids; 22 { 23 // TODO: simplify this shit! 24 // The complexity here is that we cannot pre-transform in any order 25 // as the bones depend on previous bones, but ARE NOT IN ORDER 26 // 27 // Either rewrite this a lot nicer, or sort the bones on creation 28 // by tree-order. 29 30 ids.reserve( m_data->m_data.size() ); 31 { 32 nv::vector< sint16 > ids_next; 33 ids_next.reserve( m_data->m_data.size() ); 34 ids_next.push_back( -1 ); 35 while ( !ids_next.empty() ) 36 { 37 sint16 pid = ids_next.back(); 38 ids_next.pop_back(); 39 for ( sint16 i = 0; i < sint16(m_data->m_data.size()); ++i ) 40 if ( m_data->m_data[i]->get_parent_id() == pid ) 41 { 42 sint16* it = nv::find( ids.begin(), ids.end(), i ); 43 if ( it == ids.end() ) 44 { 45 ids.push_back( i ); 46 ids_next.push_back( i ); 47 } 48 } 49 } 50 } 51 52 if ( ids.size() != m_data->m_data.size() ) 53 { 54 NV_LOG_WARNING( "Bad skeleton!" ); 55 } 56 } 57 58 NV_LOG_DEBUG( "ID/PID" ); 59 for ( auto id : ids ) 60 { 61 data_channel_set* keys = m_data->m_data[id]; 20 62 sint16 parent_id = keys->get_parent_id(); 21 data_channel_set* pkeys = ( parent_id != -1 ? m_data->m_data[parent_id] : nullptr ); 63 NV_LOG_DEBUG( "Id : ", id, " PID", parent_id ); 64 data_channel_set* pkeys = ( parent_id != -1 ? m_data->m_data[parent_id] : nullptr ); 22 65 size_t count = ( keys ? keys->get_channel_size(0) : 0 ); 23 66 size_t pcount = ( pkeys ? pkeys->get_channel_size(0) : 0 ); … … 26 69 { 27 70 data_channel_access< nv_key_transform > channel_creator( keys, 0 ); 71 28 72 nv_key_transform* channel = channel_creator.data(); 29 73 const nv_key_transform* pchannel = pkeys->get_channel(0)->data_cast< nv_key_transform >(); … … 38 82 if ( m_data->m_frame_rate == 1 ) 39 83 { 40 m_data->m_frame_rate = 32;41 m_data->m_ duration = static_cast<float>( max_frames );84 m_data->m_frame_rate = 32; 85 m_data->m_frame_count = max_frames; 42 86 } 43 87
Note: See TracChangeset
for help on using the changeset viewer.