Changeset 420


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
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/formats/nmd_loader.hh

    r416 r420  
    2020        {
    2121                MESH,
    22                 STREAM,
     22                ANIMATION,
    2323                NODE,
    24                 STRING_TABLE,
    25                 ANIMATION,
    26                 KEY_CHANNEL,
     24                STRINGS,
     25                DATA
    2726        };
    2827
     
    3231                uint32 version;
    3332                uint32 elements;
     33                uint32 attributes;
    3434        };
     35
     36        enum class nmd_datatype : uint16
     37        {
     38                STRING,
     39                INTEGER,
     40                FLOAT
     41        };
     42
     43        struct nmd_attribute
     44        {
     45                uint64       key;
     46                uint8        data[22];
     47                nmd_datatype type;
     48        };
     49        static_assert( sizeof( nmd_attribute ) == 32, "alignment issue!" );
     50
    3551
    3652        struct nmd_element_header
    3753        {
    3854                nmd_type type;
    39                 uint16   name;
    4055                uint16   children;
    4156                uint32   size;
     57                uint64   name_hash;
     58                mat4     transform;
     59                sint16   parent_id;
     60                uint16   attributes;
    4261        };
    4362
     
    4968        };
    5069
    51         struct nmd_node_header
    52         {
    53                 sint16 parent_id;
    54                 mat4   transform;
    55         };
    56 
    57         struct nmd_stream_header
     70        struct nmd_channel_header
    5871        {
    5972                data_descriptor format;
     
    6477        {
    6578        public:
    66                 nmd_loader() : m_node_data( nullptr ), m_node_array( nullptr ), m_strings( nullptr ) {}
     79                nmd_loader() : m_node_data( nullptr ), m_node_array( nullptr ) {} //, m_strings( nullptr ) {}
    6780                virtual bool load( stream& source );
    6881                virtual data_channel_set* release_mesh_data( size_t index = 0 );
     
    7487        private:
    7588                void reset();
     89                void skip_attributes( stream& source, uint32 count );
    7690                bool load_mesh( stream& source, const nmd_element_header& e );
    7791                bool load_strings( stream& source );
    7892                bool load_animation( stream& source, const nmd_element_header& e );
     93                bool load_node( stream& source, mesh_node_data* data, const nmd_element_header& e );
     94                bool load_channel( stream& source, data_channel_set* channel_set );
     95                bool load_channel_set( stream& source, data_channel_set* channel_set, const nmd_element_header& e );
    7996
    8097                mesh_nodes_data*            m_node_data;
    8198                mesh_node_data*             m_node_array;
    82                 string_table*               m_strings;
    83                 vector< uint16 >            m_mesh_names;
    84                 vector< uint16 >            m_node_names;
     99//              string_table*               m_strings;
     100//              vector< uint16 >            m_mesh_names;
     101//              vector< uint16 >            m_node_names;
    85102                vector< data_channel_set* > m_meshes;
    86103        };
  • trunk/nv/interface/mesh_data.hh

    r419 r420  
    2424        struct mesh_node_data
    2525        {
    26                 std::string    name;
    27                 sint16    target_id;
     26                uint64    name_hash;
    2827                sint16    parent_id;
    2928                mat4      transform;
     
    5554                }
    5655
    57                 const mesh_node_data* get_node( const std::string& name ) const
     56                const mesh_node_data* get_node_by_hash( uint64 h ) const
    5857                {
    5958                        for ( uint32 i = 0; i < m_count; ++i )
    6059                        {
    61                                 if ( m_nodes[ i ].name == name )
     60                                if ( m_nodes[ i ].name_hash == h )
    6261                                        return &m_nodes[ i ];
    6362                        }
     
    6564                }
    6665
    67                 int get_node_index( const std::string& name ) const
     66                int get_node_index_by_hash( uint64 h ) const
    6867                {
    6968                        for ( uint32 i = 0; i < m_count; ++i )
    7069                        {
    71                                 if ( m_nodes[ i ].name == name )
     70                                if ( m_nodes[ i ].name_hash == h )
    7271                                        return int( i );
    7372                        }
     
    7574                }
    7675
    77                 data_channel_set* release_node_data( size_t i )
     76                data_channel_set* rlease_node_data( size_t i )
    7877                {
    7978                        data_channel_set* result = m_nodes[i].data;
     
    119118                        return &m_meshes[ index ];
    120119                }
    121 //              const mesh_data* get_mesh( const std::string& name ) const
    122 //              {
    123 //                      for ( uint32 i = 0; i < m_count; ++i )
    124 //                      {
    125 //                              if ( m_meshes[ i ].get_name() == name )
    126 //                                      return &m_meshes[ i ];
    127 //                      }
    128 //                      return nullptr;
    129 //              }
    130120                uint32 get_count() const { return m_count; }
    131121                const mesh_nodes_data* get_nodes() const { return m_nodes; }
  • 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!
  • trunk/src/formats/md3_loader.cc

    r419 r420  
    426426
    427427                nodes[i].transform = mat4();
    428                 nodes[i].name      = name.to_string();
     428                nodes[i].name_hash = hash_string< uint64 >( name.data() );
    429429                nodes[i].parent_id = -1;
    430                 nodes[i].target_id = -1;
    431430                nodes[i].data      = data_channel_set_creator::create( 1 );
    432431                load_tags( data_channel_set_creator( nodes[i].data ).add_channel<md3_key>( uint32( md3->header.num_frames ) ).channel(), name );
  • trunk/src/formats/md5_loader.cc

    r419 r420  
    116116                        for ( size_t i = 0; i < m_nodes->get_count(); ++i )
    117117                        {
    118                                 sstream >> nodes[i].name >> nodes[i].parent_id;
     118                                std::string name;
     119                                sstream >> name >> nodes[i].parent_id;
    119120                                vec3 pos;
    120121                                quat orient;
     
    125126                                sstream >> orient.x >> orient.y >> orient.z;
    126127                                unit_quat_w( orient );
    127                                 remove_quotes( nodes[i].name );
    128                                 nodes[i].target_id       = -1;
     128                                remove_quotes( name );
     129//                              nodes[i].name = name;
     130                                nodes[i].name_hash = hash_string< uint64 >( name.c_str() );
     131//                              nodes[i].target_id       = -1;
    129132                                nodes[i].parent_id       = -1;
    130133                                nodes[i].transform       = transform( pos, orient ).inverse().extract();
     
    246249                        {
    247250                                std::string    name;
    248                                 sstream >> nodes[i].name >> nodes[i].parent_id >> joint_infos[i].flags >> joint_infos[i].start_index;
     251                                sstream >> name >> nodes[i].parent_id >> joint_infos[i].flags >> joint_infos[i].start_index;
    249252                                remove_quotes( name );
     253//                              nodes[i].name = name;
     254                                nodes[i].name_hash = hash_string< uint64 >( name.c_str() );
    250255                                nodes[i].transform = mat4();
    251                                 nodes[i].target_id = -1;
    252256                                nodes[i].data = data_channel_set_creator::create( 1 );
    253257                                data_channel_set_creator( nodes[i].data ).add_channel< md5_key_t >( num_frames );
  • trunk/src/formats/nmd_loader.cc

    r419 r420  
    1818        nmd_header root_header;
    1919        source.read( &root_header, sizeof( root_header ), 1 );
     20        skip_attributes( source, root_header.attributes );
    2021        for ( uint32 i = 0; i < root_header.elements; ++i )
    2122        {
    2223                nmd_element_header element_header;
    2324                source.read( &element_header, sizeof( element_header ), 1 );
     25                skip_attributes( source, element_header.attributes );
    2426                switch ( element_header.type )
    2527                {
    2628                case nmd_type::MESH           : load_mesh( source, element_header ); break;
    2729                case nmd_type::ANIMATION      : load_animation( source, element_header ); break;
    28                 case nmd_type::STRING_TABLE   : load_strings( source ); break;
     30//              case nmd_type::STRING_TABLE   : load_strings( source ); break;
    2931                default: NV_ASSERT( false, "UNKNOWN NMD ELEMENT!" ); break;
    3032                }
     
    3638{
    3739        data_channel_set* mesh = data_channel_set_creator::create( e.children );
    38         data_channel_set_creator mcreator( mesh );
    39         for ( uint32 s = 0; s < e.children; ++s )
    40         {
    41                 nmd_element_header element_header;
    42                 source.read( &element_header, sizeof( element_header ), 1 );
    43                 NV_ASSERT( element_header.type == nmd_type::STREAM, "STREAM expected!" );
    44 
    45                 nmd_stream_header stream_header;
    46                 source.read( &stream_header, sizeof( stream_header ), 1 );
    47                 raw_data_channel_access channel( mcreator.add_channel( stream_header.format, stream_header.count ) );
    48                 source.read( channel.raw_data(), channel.element_size(), channel.size() );
    49         }
    50         m_mesh_names.push_back( e.name );
     40        load_channel_set( source, mesh, e );
     41//      m_mesh_names.push_back( e.name );
    5142        m_meshes.push_back( mesh );
    5243        return true;
     
    5647{
    5748        data_channel_set* result = m_meshes[ index ];
    58         if ( m_strings ) data_channel_set_creator( result ).set_name( m_strings->get( m_mesh_names[ index ] ) );
     49//      if ( m_strings ) data_channel_set_creator( result ).set_name( m_strings->get( m_mesh_names[ index ] ) );
    5950        m_meshes[ index ] = nullptr;
    6051        return result;
     
    7768{
    7869        for ( auto mesh : m_meshes ) if ( mesh ) delete mesh;
    79         if ( m_strings )   delete m_strings;
     70//      if ( m_strings )   delete m_strings;
    8071        if ( m_node_data ) delete m_node_data;
    8172        m_meshes.clear();
    82         m_mesh_names.clear();
    83         m_node_names.clear();
     73//      m_mesh_names.clear();
     74//      m_node_names.clear();
    8475
    8576        m_node_data  = nullptr;
    8677        m_node_array = nullptr;
    87         m_strings    = nullptr;
     78//      m_strings    = nullptr;
     79}
     80
     81void nv::nmd_loader::skip_attributes( stream& source, uint32 count )
     82{
     83        if ( count == 0 ) return;
     84        source.seek( count * sizeof( nmd_attribute ), origin::CUR );
    8885}
    8986
     
    9390}
    9491
    95 bool nv::nmd_loader::load_strings( stream& source )
    96 {
    97         NV_ASSERT( m_strings == nullptr, "MULTIPLE STRING ENTRIES!" );
    98         m_strings = new string_table( &source );
     92bool nv::nmd_loader::load_strings( stream& /*source*/ )
     93{
     94//      NV_ASSERT( m_strings == nullptr, "MULTIPLE STRING ENTRIES!" );
     95//      m_strings = new string_table( &source );
    9996        return true;
    10097}
     
    110107                nmd_element_header element_header;
    111108                source.read( &element_header, sizeof( element_header ), 1 );
     109                skip_attributes( source, element_header.attributes );
    112110                NV_ASSERT( element_header.type == nmd_type::NODE, "NODE expected!" );
    113                 m_node_names.push_back( element_header.name );
    114                 uint16 ch_count = element_header.children;
    115 
    116                 nmd_node_header node_header;
    117                 source.read( &node_header, sizeof( node_header ), 1 );
    118                 m_node_array[i].parent_id     = node_header.parent_id;
    119                 m_node_array[i].transform     = node_header.transform;
    120                 m_node_array[i].data          = nullptr;
    121                 if ( ch_count > 0 )
    122                 {
    123                         data_channel_set* kdata = data_channel_set_creator::create( ch_count );
    124                         data_channel_set_creator kaccess( kdata );
    125                         m_node_array[i].data = kdata;
    126                         for ( uint32 c = 0; c < ch_count; ++c )
    127                         {
    128                                 source.read( &element_header, sizeof( element_header ), 1 );
    129                                 NV_ASSERT( element_header.type == nmd_type::KEY_CHANNEL, "CHANNEL expected!" );
    130                                 nv::nmd_stream_header cheader;
    131                                 source.read( &cheader, sizeof( cheader ), 1 );
    132                                 raw_data_channel_access channel( kaccess.add_channel( cheader.format, cheader.count ) );
    133                                 source.read( channel.raw_data(), channel.element_size(), channel.size() );
    134                         }
    135                 }
     111//              m_node_names.push_back( element_header.name );
     112                load_node( source, &m_node_array[i], element_header );
    136113        }
    137114        m_node_data = new mesh_nodes_data( "animation", e.children, m_node_array, animation_header.frame_rate, animation_header.duration, animation_header.flat );
     
    139116}
    140117
     118bool nv::nmd_loader::load_node( stream& source, mesh_node_data* data, const nmd_element_header& e )
     119{
     120        data->name_hash = e.name_hash;
     121        data->parent_id = e.parent_id;
     122        data->transform = e.transform;
     123        data->data = nullptr;
     124        if ( e.children > 0 )
     125        {
     126                data->data = data_channel_set_creator::create( e.children );
     127                load_channel_set( source, data->data, e );
     128        }
     129        return true;
     130}
     131
     132bool nv::nmd_loader::load_channel( stream& source, data_channel_set* channel_set )
     133{
     134        data_channel_set_creator kaccess( channel_set );
     135        nmd_channel_header cheader;
     136        source.read( &cheader, sizeof( cheader ), 1 );
     137        raw_data_channel_access channel( kaccess.add_channel( cheader.format, cheader.count ) );
     138        source.read( channel.raw_data(), channel.element_size(), channel.size() );
     139        return true;
     140}
     141
     142bool nv::nmd_loader::load_channel_set( stream& source, data_channel_set* channel_set, const nmd_element_header& e )
     143{
     144        data_channel_set_creator kaccess( channel_set );
     145        for ( uint32 c = 0; c < e.children; ++c )
     146        {
     147                load_channel( source, channel_set );
     148        }
     149        return true;
     150}
     151
    141152mesh_nodes_data* nv::nmd_loader::release_mesh_nodes_data( size_t )
    142153{
    143154        if ( m_node_data )
    144155        {
    145                 if ( m_strings )
    146                 {
    147                         for ( uint32 i = 0; i < m_node_data->get_count(); ++i )
    148                         {
    149                                 m_node_array[i].name = m_strings->get( m_node_names[i] );
    150                         }
    151                 }
     156//              if ( m_strings )
     157//              {
     158//                      for ( uint32 i = 0; i < m_node_data->get_count(); ++i )
     159//                      {
     160//                              m_node_array[i].name = m_strings->get( m_node_names[i] );
     161//                              m_node_array[i].name_hash = hash_string< uint64 >( m_strings->get( m_node_names[i] ) );
     162//                      }
     163//              }
    152164                mesh_nodes_data* result = m_node_data;
    153165                m_node_data = nullptr;
     
    161173// nmd format dump
    162174// HACK : TEMPORARY - will go to it's own file, probably nmd_io
     175static void nmd_dump_channel( const raw_data_channel* channel , stream& stream_out )
     176{
     177        nmd_channel_header sheader;
     178        sheader.format = channel->descriptor();
     179        sheader.count = channel->size();
     180        stream_out.write( &sheader, sizeof( sheader ), 1 );
     181        stream_out.write( channel->raw_data(), channel->element_size(), channel->size() );
     182}
     183
     184static void nmd_dump_channel_set( const data_channel_set* channel_set, stream& stream_out )
     185{
     186        for ( auto& channel : *channel_set )
     187        {
     188                nmd_dump_channel( &channel, stream_out );
     189        }
     190}
     191
    163192static void nmd_dump_mesh( const data_channel_set* mesh, stream& stream_out )
    164193{
    165         uint32 size = sizeof( nmd_element_header );
     194        uint32 size = 0;
    166195        for ( auto& chan : *mesh )
    167196        {
    168                 size += sizeof( nmd_element_header ) + sizeof( nmd_stream_header );
     197                size += sizeof( nmd_channel_header );
    169198                size += chan.raw_size();
    170199        }
    171200
    172201        nmd_element_header eheader;
    173         eheader.type     = nmd_type::MESH;
    174         eheader.name     = 0;
    175         eheader.children = static_cast< uint16 >( mesh->size() );
    176         eheader.size     = size;
     202        eheader.type       = nmd_type::MESH;
     203//      eheader.name       = 0;
     204        eheader.children   = static_cast< uint16 >( mesh->size() );
     205        eheader.size       = size;
     206        eheader.name_hash  = 0;
     207        eheader.transform  = mat4();
     208        eheader.parent_id  = -1;
     209        eheader.attributes = 0;
    177210        stream_out.write( &eheader, sizeof( eheader ), 1 );
    178 
    179         for ( auto& chan : *mesh )
    180         {
    181                 nmd_element_header cheader;
    182                 eheader.name     = 0;
    183                 cheader.type     = nmd_type::STREAM;
    184                 cheader.children = 0;
    185                 cheader.size     = chan.raw_size() + sizeof( nmd_stream_header );
    186                 stream_out.write( &cheader, sizeof( cheader ), 1 );
    187 
    188                 nmd_stream_header sheader;
    189                 sheader.format = chan.descriptor();
    190                 sheader.count  = chan.size();
    191                 stream_out.write( &sheader, sizeof( sheader ), 1 );
    192                 stream_out.write( chan.raw_data(), chan.element_size(), chan.size() );
    193         }
    194 }
    195 
    196 static void nmd_dump_nodes_data( const mesh_nodes_data* nodes, stream& stream_out, string_table_creator* strings )
     211        nmd_dump_channel_set( mesh, stream_out );
     212}
     213
     214static void nmd_dump_node( const mesh_node_data* node, stream& stream_out )
     215{
     216        uint32 chan_size = 0;
     217        uint32 chan_count = ( node->data ? node->data->size() : 0 );
     218        for ( uint32 c = 0; c < chan_count; ++c )
     219        {
     220                chan_size += sizeof( nmd_channel_header );
     221                chan_size += node->data->get_channel( c )->raw_size();
     222        }
     223
     224        nmd_element_header eheader;
     225        eheader.type = nmd_type::NODE;
     226        //              eheader.name     = strings->insert( node->name );
     227        eheader.children   = static_cast<uint16>( chan_count );
     228        eheader.size       = chan_size;
     229        eheader.name_hash  = node->name_hash;
     230        eheader.parent_id  = node->parent_id;
     231        eheader.transform  = node->transform;
     232        eheader.attributes = 0;
     233        stream_out.write( &eheader, sizeof( eheader ), 1 );
     234        if ( node->data ) nmd_dump_channel_set( node->data, stream_out );
     235}
     236
     237static void nmd_dump_nodes_data( const mesh_nodes_data* nodes, stream& stream_out, string_table_creator* /*strings*/ )
    197238{
    198239        uint32 total = sizeof( nmd_animation_header );
     
    200241        {
    201242                const mesh_node_data* node = nodes->get_node(i);
    202                 total += sizeof( nmd_element_header ) + sizeof( nmd_node_header );
     243                total += sizeof( nmd_element_header );
    203244                if ( node->data )
    204245                        for ( uint32 c = 0; c < node->data->size(); ++c )
    205246                        {
    206                                 total += sizeof( nmd_element_header ) + sizeof( nmd_stream_header );
     247                                total += sizeof( nmd_channel_header );
    207248                                total += node->data->get_channel(c)->raw_size();
    208249                        }
     
    210251
    211252        nmd_element_header header;
    212         header.name     = 0;
    213         header.type     = nmd_type::ANIMATION;
    214         header.children = static_cast< uint16 >( nodes->get_count() );
    215         header.size     = total;
     253//      header.name       = 0;
     254        header.type       = nmd_type::ANIMATION;
     255        header.children   = static_cast< uint16 >( nodes->get_count() );
     256        header.size       = total;
     257        header.name_hash  = 0;
     258        header.transform  = mat4();
     259        header.parent_id  = -1;
     260        header.attributes = 0;
     261
    216262        stream_out.write( &header, sizeof( header ), 1 );
    217263
     
    224270        for ( uint32 i = 0; i < nodes->get_count(); ++i )
    225271        {
    226                 const mesh_node_data* node = nodes->get_node(i);
    227                 uint32 chan_size  = 0;
    228                 uint32 chan_count = ( node->data ? node->data->size() : 0 );
    229                 for ( uint32 c = 0; c < chan_count; ++c )
    230                 {
    231                         chan_size += sizeof( nmd_element_header ) + sizeof( nv::nmd_stream_header );
    232                         chan_size += node->data->get_channel(c)->raw_size();
    233                 }
    234 
    235                 nmd_element_header eheader;
    236                 eheader.type     = nmd_type::NODE;
    237                 eheader.name     = strings->insert( node->name );
    238                 eheader.children = static_cast< uint16 >( chan_count );
    239                 eheader.size     = sizeof( nmd_node_header ) + chan_size;
    240                 stream_out.write( &eheader, sizeof( eheader ), 1 );
    241 
    242                 nmd_node_header nheader;
    243                 nheader.parent_id = node->parent_id;
    244                 nheader.transform = node->transform;
    245                 stream_out.write( &nheader, sizeof( nheader ), 1 );
    246 
    247                 for ( uint32 c = 0; c < chan_count; ++c )
    248                 {
    249                         const raw_data_channel* channel = node->data->get_channel(c);
    250 
    251                         eheader.type     = nmd_type::KEY_CHANNEL;
    252                         eheader.children = 0;
    253                         eheader.size     = sizeof( nmd_stream_header ) + channel->raw_size();
    254                         stream_out.write( &eheader, sizeof( eheader ), 1 );
    255 
    256                         nmd_stream_header cheader;
    257                         cheader.format    = channel->descriptor();
    258                         cheader.count     = channel->size();
    259                         stream_out.write( &cheader, sizeof( cheader ), 1 );
    260                         stream_out.write( channel->raw_data(), channel->element_size(), channel->size() );
    261                 }
     272                nmd_dump_node( nodes->get_node( i ), stream_out );
    262273        }
    263274}
     
    269280                nmd_header header;
    270281                header.id       = four_cc<'n','m','f','1'>::value;
    271                 header.elements = 1; // +1 string array
     282                header.elements = 0; // +1 string array
    272283                header.elements += model->get_count();
    273284                if ( model->get_nodes() && model->get_nodes()->get_count() > 0 )
    274285                        header.elements += 1;//  +1 bone array
    275286                header.version  = 1;
     287                header.attributes = 0;
    276288                stream_out.write( &header, sizeof( header ), 1 );
    277289        }
     
    288300        }
    289301
    290         nmd_element_header sheader;
    291         sheader.type     = nv::nmd_type::STRING_TABLE;
    292         sheader.name     = 0;
    293         sheader.size     = strings.dump_size();
    294         sheader.children = 0;
    295         stream_out.write( &sheader, sizeof( sheader ), 1 );
    296         strings.dump( &stream_out );
    297 }
     302//      nmd_element_header sheader;
     303//      sheader.type     = nv::nmd_type::STRING_TABLE;
     304//      sheader.name     = 0;
     305//      sheader.size     = strings.dump_size();
     306//      sheader.children = 0;
     307//  sheader.attributes = 0;
     308//      stream_out.write( &sheader, sizeof( sheader ), 1 );
     309//      strings.dump( &stream_out );
     310}
  • trunk/src/gfx/skeletal_mesh.cc

    r419 r420  
    173173{
    174174        if ( m_prepared ) return;
    175         unordered_map< std::string, nv::uint16 > bone_names;
     175        unordered_map< uint64, uint16 > bone_names;
    176176        m_offsets = new mat4[ bones->get_count() ];
    177177        for ( nv::uint16 bi = 0; bi < bones->get_count(); ++bi )
    178178        {
    179179                const mesh_node_data* bone = bones->get_node(bi);
    180                 bone_names[ bone->name ] = bi;
     180                bone_names[ bone->name_hash ] = bi;
    181181                m_offsets[bi] = bone->transform;
    182182        }
     
    187187                sint16 bone_id = -1;
    188188
    189                 auto bi = bone_names.find( node->name );
     189                auto bi = bone_names.find( node->name_hash );
    190190                if ( bi != bone_names.end() )
    191191                {
Note: See TracChangeset for help on using the changeset viewer.