Ignore:
Timestamp:
07/15/15 19:59:40 (10 years ago)
Author:
epyon
Message:
  • mesh nodes store name hash instead of string
  • nmd format refactoring
File:
1 edited

Legend:

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

    r419 r420  
    199199                aiBone* bone   = mesh->mBones[m];
    200200                mat4    offset = assimp_mat4_cast( bone->mOffsetMatrix );
    201                 bones[m].name = bone->mName.data;
     201//              bones[m].name = bone->mName.data;
     202                bones[m].name_hash = hash_string< uint64 >( bone->mName.data );
    202203                bones[m].data = nullptr;
    203204                bones[m].parent_id = -1;
    204                 bones[m].target_id = -1;
     205//              bones[m].target_id = -1;
    205206                bones[m].transform = offset;
    206207        }
     
    287288        const aiScene* scene = reinterpret_cast<const aiScene*>( m_scene );
    288289        vector< mesh_node_data > final_bones;
    289         unordered_map< std::string, uint16 > names;
     290        unordered_map< uint64, uint16 > names;
    290291        for ( unsigned int m = 0; m < m_mesh_count; ++m )
    291292        {
     
    301302
    302303                                mesh_node_data& bone = bones[b];
    303                                 auto iname = names.find( bone.name );
     304                                auto iname = names.find( bone.name_hash );
    304305                                if ( iname == names.end() )
    305306                                {
     
    307308                                        uint16 index = uint16( final_bones.size() );
    308309                                        final_bones.push_back( bone );
    309                                         names[ bone.name ] = index;
     310                                        names[ bone.name_hash] = index;
    310311                                        translate[b] = index;
    311312                                }
     
    387388        mesh_node_data& a_data = nodes[ this_id ];
    388389
    389         a_data.name      = name;
    390         a_data.target_id = -1;
     390//      a_data.name      = name;
     391        a_data.name_hash = hash_string< uint64 >( name.c_str() );
    391392        a_data.parent_id = parent_id;
    392393        // This value is ignored by the create_transformed_keys, but needed by create_direct_keys!
Note: See TracChangeset for help on using the changeset viewer.