Ignore:
Timestamp:
11/03/15 19:06:23 (10 years ago)
Author:
epyon
Message:
  • cleanup of legacy code
  • resource updates
File:
1 edited

Legend:

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

    r475 r480  
    5050}
    5151
    52 mesh_data_pack* nv::nmd_loader::release_mesh_data_pack()
    53 {
    54         uint32 size = m_meshes.size();
    55         data_channel_set* meshes = data_channel_set_creator::create_set_array( size, 0 );
    56         for ( uint32 i = 0; i < size; ++i )
    57         {
    58                 meshes[i] = move( *m_meshes[i] );
    59                 delete m_meshes[i];
    60         }
    61         m_meshes.clear();
    62         return new mesh_data_pack( size, meshes, release_mesh_nodes_data() );
    63 }
    64 
    6552void nv::nmd_loader::reset()
    6653{
     
    240227}
    241228
    242 void nv::nmd_dump( stream& stream_out, const mesh_data_pack* model, const string_table* strings, uint64 name )
     229void nv::nmd_dump( stream& stream_out, array_view< data_channel_set* > meshes, const mesh_nodes_data* nodes, const string_table* strings /*= nullptr*/, uint64 name /*= 0 */ )
    243230{
    244231        uint32 elements = ( strings ? 1 : 0 ) // +1 string array
    245                 + model->get_count() // meshes
    246                 + ( model->get_node_count() > 0 ? 1 : 0 ); // nodes
     232                + meshes.size() // meshes
     233                + ( nodes && nodes->size() > 0 ? 1 : 0 ); // nodes
    247234        nmd_dump_header( stream_out, elements, name );
    248235
    249         for ( uint32 i = 0; i < model->get_count(); ++i )
    250         {
    251                 nmd_dump_element( stream_out, *model->get_mesh( i ), nv::nmd_type::MESH );
    252         }
    253 
    254         if ( model->get_node_count() > 0 )
    255         {
    256                 nmd_dump_nodes( stream_out, *model->get_nodes() );
     236        for ( uint32 i = 0; i < meshes.size(); ++i )
     237        {
     238                NV_ASSERT( meshes[i], "mesh is null!" );
     239                nmd_dump_element( stream_out, *meshes[i], nv::nmd_type::MESH );
     240        }
     241
     242        if ( nodes && nodes->size() > 0 )
     243        {
     244                nmd_dump_nodes( stream_out, *nodes );
    257245        }
    258246
     
    262250        }
    263251}
     252
     253void nv::nmd_dump( stream& stream_out, const mesh_nodes_data& animation, const string_table* strings, uint64 name )
     254{
     255        uint32 elements = ( strings ? 1 : 0 ) // +1 string array
     256                + ( animation.size() > 0 ? 1 : 0 ); // nodes
     257        nmd_dump_header( stream_out, elements, name );
     258
     259        if ( animation.size() > 0 )
     260        {
     261                nmd_dump_nodes( stream_out, animation );
     262        }
     263
     264        if ( strings )
     265        {
     266                nmd_dump_strings( stream_out, *strings );
     267        }
     268}
Note: See TracChangeset for help on using the changeset viewer.