Changeset 224 for trunk/src/formats/md3_loader.cc
- Timestamp:
- 01/02/14 20:52:34 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/formats/md3_loader.cc
r200 r224 286 286 } 287 287 288 /* 288 289 mesh* nv::md3_loader::release_mesh() 289 290 { … … 314 315 vertex_attribute< vec3 >* normal = m->add_attribute<vec3>("nv_normal"); 315 316 vertex_attribute< vec2 >* texcoord = m->add_attribute<vec2>("nv_texcoord"); 316 vertex_attribute< uint 16 >* indices = m->add_indices<uint16>();317 vertex_attribute< uint32 >* indices = m->add_indices<uint32>(); 317 318 318 319 load_positions( position->get(), frame ); … … 325 326 return m; 326 327 } 328 */ 327 329 328 330 void nv::md3_loader::load_tags( std::vector<mat4>& t, const std::string& tag ) … … 349 351 } 350 352 353 mesh_data* nv::md3_loader::release_mesh_data() 354 { 355 mesh_data_creator m; 356 357 load_positions( m.get_positions() ); 358 load_normals( m.get_normals() ); 359 load_texcoords( m.get_texcoords() ); 360 load_indicies( m.get_indices() ); 361 362 std::vector< std::string > names; 363 load_tag_names( names ); 364 365 for ( auto& name : names ) 366 { 367 load_tags( m.get_tag_map()[ name ], name ); 368 } 369 370 return m.release(); 371 } 372 373 mesh_data* nv::md3_loader::get_frame( sint32 frame ) 374 { 375 mesh_data_creator m; 376 377 load_positions( m.get_positions(), frame ); 378 load_normals( m.get_normals(), frame ); 379 load_texcoords( m.get_texcoords() ); 380 load_indicies( m.get_indices() ); 381 382 std::vector< std::string > names; 383 load_tag_names( names ); 384 385 for ( auto& name : names ) 386 { 387 load_tags( m.get_tag_map()[ name ], name ); 388 } 389 return m.release(); 390 } 391 351 392 size_t md3_loader::get_max_frames() const 352 393 { … … 465 506 } 466 507 467 void md3_loader::load_indicies( std::vector<uint 16>& idx )508 void md3_loader::load_indicies( std::vector<uint32>& idx ) 468 509 { 469 510 md3_t* md3 = (md3_t*)m_md3; … … 480 521 { 481 522 const md3_triangle_t& t = surface.triangles[j]; 482 idx.push_back( static_cast< uint 16>( index_base + t.indexes[0] ) );483 idx.push_back( static_cast< uint 16>( index_base + t.indexes[1] ) );484 idx.push_back( static_cast< uint 16>( index_base + t.indexes[2] ) );523 idx.push_back( static_cast< uint32 >( index_base + t.indexes[0] ) ); 524 idx.push_back( static_cast< uint32 >( index_base + t.indexes[1] ) ); 525 idx.push_back( static_cast< uint32 >( index_base + t.indexes[2] ) ); 485 526 } 486 527 … … 490 531 } 491 532 492 keyframed_mesh_data::keyframed_mesh_data( keyframed_loader* loader )493 {494 loader->load_positions( m_positions );495 loader->load_normals( m_normals );496 loader->load_texcoords( m_texcoords );497 loader->load_indicies( m_indices );498 499 std::vector< std::string > names;500 501 md3_loader* md3loader = dynamic_cast< md3_loader* >( loader );502 if ( md3loader != nullptr )503 {504 md3loader->load_tag_names( names );505 for ( auto& name : names )506 {507 md3loader->load_tags( m_tags[ name ], name );508 }509 }510 511 m_frames = loader->get_max_frames();512 }513
Note: See TracChangeset
for help on using the changeset viewer.