Ignore:
Timestamp:
01/02/14 20:52:34 (11 years ago)
Author:
epyon
Message:
  • universal mesh format
  • removed keyframed_mesh_data
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/formats/md3_loader.cc

    r200 r224  
    286286}
    287287
     288/*
    288289mesh* nv::md3_loader::release_mesh()
    289290{
     
    314315        vertex_attribute< vec3 >* normal   = m->add_attribute<vec3>("nv_normal");
    315316        vertex_attribute< vec2 >* texcoord = m->add_attribute<vec2>("nv_texcoord");
    316         vertex_attribute< uint16 >* indices  = m->add_indices<uint16>();
     317        vertex_attribute< uint32 >* indices  = m->add_indices<uint32>();
    317318
    318319        load_positions( position->get(), frame );
     
    325326        return m;
    326327}
     328*/
    327329
    328330void nv::md3_loader::load_tags( std::vector<mat4>& t, const std::string& tag )
     
    349351}
    350352
     353mesh_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
     373mesh_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
    351392size_t md3_loader::get_max_frames() const
    352393{
     
    465506}
    466507
    467 void md3_loader::load_indicies( std::vector<uint16>& idx )
     508void md3_loader::load_indicies( std::vector<uint32>& idx )
    468509{
    469510        md3_t* md3 = (md3_t*)m_md3;
     
    480521                {
    481522                        const md3_triangle_t& t = surface.triangles[j];
    482                         idx.push_back( static_cast< uint16 >( index_base + t.indexes[0] ) );
    483                         idx.push_back( static_cast< uint16 >( index_base + t.indexes[1] ) );
    484                         idx.push_back( static_cast< uint16 >( 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] ) );
    485526                }
    486527
     
    490531}
    491532
    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.