Changeset 416 for trunk/src/formats/md5_loader.cc
- Timestamp:
- 07/10/15 14:16:42 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/formats/md5_loader.cc
r415 r416 10 10 #include "nv/stl/vector.hh" 11 11 #include "nv/io/std_stream.hh" 12 #include "nv/interface/data_channel_access.hh" 12 13 13 14 #include <stdio.h> // sscanf … … 136 137 { 137 138 assert( m_type == MESH ); 138 mesh_data* mesh = new mesh_data("md5_mesh");139 data_channel_set_creator mesh; 139 140 140 141 uint32 num_verts = 0; … … 163 164 data_channel_creator<md5_vtx_pntiw> ch_pntiw( num_verts ); 164 165 tdata = ch_t.data(); 165 mesh ->add_channel( ch_pnt.release() );166 mesh ->add_channel( ch_t.release() );166 mesh.add_channel( ch_pnt.release() ); 167 mesh.add_channel( ch_t.release() ); 167 168 // TODO: hack to prevent rendering 168 169 //ch_pntiw->m_count = 0; 169 mesh ->add_channel( ch_pntiw.release() );170 mesh.add_channel( ch_pntiw.release() ); 170 171 } 171 172 weight_info.resize( num_verts ); … … 210 211 } 211 212 212 mesh ->add_channel( ch_i.release() );213 mesh.add_channel( ch_i.release() ); 213 214 } 214 215 else if ( command == "numweights" ) … … 235 236 } 236 237 237 prepare_mesh( nodes, weight_info.size(), mesh, weights.data(), weight_info.data() ); 238 239 m_meshes[ num_meshes ] = mesh; 238 data_channel_set* mdata = mesh.release(); 239 prepare_mesh( nodes, weight_info.size(), mdata, weights.data(), weight_info.data() ); 240 241 m_meshes[ num_meshes ] = mdata; 240 242 num_meshes++; 241 243 } // mesh … … 258 260 nodes[i].data = new key_data; 259 261 data_channel_creator< md5_key_t > fc( num_frames ); 260 nodes[i].data->add_ channel( fc.release() );262 nodes[i].data->add_key_channel( fc.release() ); 261 263 next_line( sstream ); 262 264 } … … 335 337 } 336 338 337 bool md5_loader::prepare_mesh( mesh_node_data* nodes, uint32 vtx_count, mesh_data* mdata, md5_weight* weights, md5_weight_info* weight_info )339 bool md5_loader::prepare_mesh( mesh_node_data* nodes, uint32 vtx_count, data_channel_set* mdata, md5_weight* weights, md5_weight_info* weight_info ) 338 340 { 339 341 assert( m_type == MESH ); … … 400 402 } 401 403 402 const uint32* idata = reinterpret_cast< uint32* >( const_cast< uint8* >( mdata->get_ index_channel()->raw_data() ) );404 const uint32* idata = reinterpret_cast< uint32* >( const_cast< uint8* >( mdata->get_channel( slot::INDEX )->raw_data() ) ); 403 405 const md5_vtx_t* tdata = mdata->get_channel_data<md5_vtx_t>(); 404 406 405 407 // Prepare normals 406 uint32 tri_count = mdata->get_c ount() / 3;408 uint32 tri_count = mdata->get_channel_size( slot::INDEX ) / 3; 407 409 for ( unsigned int i = 0; i < tri_count; ++i ) 408 410 { … … 503 505 } 504 506 505 mesh_data* nv::md5_loader::release_mesh_data( size_t index )506 { 507 mesh_data* result = m_meshes[ index ];507 data_channel_set* nv::md5_loader::release_mesh_data( size_t index ) 508 { 509 data_channel_set* result = m_meshes[ index ]; 508 510 m_meshes[ index ] = nullptr; 509 511 return result; … … 520 522 { 521 523 uint32 size = m_meshes.size(); 522 mesh_data* meshes = new mesh_data[ size ];524 data_channel_set* meshes = data_channel_set_creator::create_array( size, 4 ); 523 525 for ( uint32 i = 0; i < size; ++i ) 524 526 { 525 m_meshes[i]->move_to( meshes[i] );527 data_channel_set_creator( m_meshes[i] ).move_to( meshes[i] ); 526 528 delete m_meshes[i]; 527 529 m_meshes[i] = nullptr;
Note: See TracChangeset
for help on using the changeset viewer.