Ignore:
Timestamp:
07/17/15 13:34:28 (10 years ago)
Author:
epyon
Message:
  • mesh formats now support string loading via string_table
  • nmd string_table dump
  • fixes all around
File:
1 edited

Legend:

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

    r424 r425  
    5757
    5858
    59 nv::assimp_loader::assimp_loader( const std::string& a_ext, uint32 a_assimp_flags /*= 0 */ )
    60         : m_scene( nullptr ), m_mesh_count(0)
     59nv::assimp_loader::assimp_loader( string_table* strings, const string_view& a_ext, uint32 a_assimp_flags /*= 0 */ )
     60        : mesh_loader( strings ), m_scene( nullptr ), m_mesh_count(0)
    6161{
    6262        m_ext   = a_ext;
     
    9292        char* data  = new char[ size ];
    9393        source.read( data, size, 1 );
    94         const aiScene* scene = aiImportFileFromMemory( data, size, m_assimp_flags, m_ext.c_str() );
     94        const aiScene* scene = aiImportFileFromMemory( data, size, m_assimp_flags, m_ext.data() );
    9595
    9696        if( !scene)
     
    125125                desc.initialize< assimp_plain_vtx >();
    126126        data_channel_set_creator maccess( data );
    127         maccess.set_name( mesh->mName.data );
     127        const char* name = mesh->mName.data;
     128        maccess.set_name( make_name( name ) );
    128129        uint8*  cdata   = maccess.add_channel( desc, mesh->mNumVertices ).raw_data();
    129130        uint16* indices = reinterpret_cast<uint16*>( maccess.add_channel< index_u16 >( mesh->mNumFaces * 3 ).raw_data() );
     
    201202                bones[m].data = data_channel_set_creator::create_set( 0 );
    202203                data_channel_set_creator access( bones[m].data );
    203                 access.set_name( hash_string< uint64 >( bone->mName.data ) );
     204                const char* name = bone->mName.data;
     205                access.set_name( make_name( name ) );
    204206                access.set_transform( offset );
    205207        }
     
    334336        mesh_node_data* bones = new mesh_node_data[ final_bones.size() ];
    335337        raw_copy( final_bones.begin(), final_bones.end(), bones );
    336         int name_;
    337         return new mesh_nodes_data( /*"bones"*/0, final_bones.size(), bones );
     338        return new mesh_nodes_data( make_name( "bones" ), final_bones.size(), bones );
    338339}
    339340
     
    356357        load_node( index, data, root, 0, -1 );
    357358
    358         int name;
    359         return new mesh_nodes_data( /*anim->mName.data*/0, count, data, frame_rate, duration, flat );
     359        return new mesh_nodes_data( make_name( static_cast<const char*>( anim->mName.data ) ), count, data, frame_rate, duration, flat );
    360360}
    361361
     
    375375        const aiScene* scene = reinterpret_cast<const aiScene*>( m_scene );
    376376        const aiNode*  node  = reinterpret_cast<const aiNode*>( vnode );
    377         std::string name( node->mName.data );
     377        string_view name( static_cast< const char* >( node->mName.data ) );
    378378        const aiAnimation* anim  = scene->mAnimations[anim_id];
    379379        const aiNodeAnim*  anode = nullptr;
     
    382382        {
    383383                anode = anim->mChannels[i];
    384                 if ( std::string( anode->mNodeName.data ) == name ) break;
     384                if ( string_view( static_cast< const char* >( anode->mNodeName.data ) ) == name ) break;
    385385                anode = nullptr;
    386386        }
     
    394394
    395395        data_channel_set_creator access( a_data.data );
    396         access.set_name( hash_string< uint64 >( name.c_str() ) );
     396        access.set_name( make_name( name ) );
    397397        access.set_parent_id( parent_id );
    398398        // This value is ignored by the create_transformed_keys, but needed by create_direct_keys!
     
    468468        {
    469469                const aiMesh* mesh = scene->mMeshes[ m ];
    470                 data_channel_set_creator( &meshes[m] ).set_name( mesh->mName.data );
     470                data_channel_set_creator( &meshes[m] ).set_name( make_name( static_cast<const char*>( mesh->mName.data ) ) );
    471471                if ( mesh->mNumBones > 0 ) has_bones = true;
    472472                load_mesh_data(&meshes[m],m);
Note: See TracChangeset for help on using the changeset viewer.