Changeset 487 for trunk/src/formats


Ignore:
Timestamp:
03/08/16 08:05:51 (9 years ago)
Author:
epyon
Message:
 
Location:
trunk/src/formats
Files:
2 edited

Legend:

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

    r486 r487  
    215215                {
    216216                        aiBone* bone  = mesh->mBones[m];
    217                         for (unsigned int w=0; w<bone->mNumWeights; w++)
     217                        for ( size_t w=0; w<bone->mNumWeights; w++)
    218218                        {
    219219                                assimp_skinned_vtx& v = vtx[ bone->mWeights[w].mVertexId ];
    220220                                bool found = false;
    221                                 for ( int i = 0 ; i < 4; ++i )
     221                                for ( size_t i = 0 ; i < 4; ++i )
    222222                                {
    223223                                        if ( v.boneweight[i] <= 0.0f )
     
    409409                        {
    410410                                assimp_skinned_vtx& vertex = channel.data()[v];
    411                                 for ( int i = 0; i < 4; ++i )
     411                                for ( size_t i = 0; i < 4; ++i )
    412412                                {
    413413                                        if ( vertex.boneweight[i] > 0.0f )
     
    429429                        mat4 tr = nv::math::inverse( assimp_mat4_cast( m_data->node_by_name[bone_data[i].name]->mTransformation ) );
    430430                        int pid = bone_data[i].parent_id;
    431                         if ( pid != -1 )
    432                                 bone_data[i].transform = tr * bone_data[pid].transform;
     431                        if ( pid >= 0 )
     432                                bone_data[i].transform = tr * bone_data[ size_t( pid ) ].transform;
    433433                        else
    434434                                bone_data[i].transform = tr;
     
    492492{
    493493        int this_is_incorrect;
    494         return m_mesh_count == 0 || m_data->scene->mNumAnimations > 0 && m_data->skeletons.size() == 0;
    495 }
    496 
    497 int indent = 0;
     494        return m_mesh_count == 0 || ( m_data->scene->mNumAnimations > 0 && m_data->skeletons.size() == 0 );
     495}
    498496
    499497void nv::assimp_loader::scan_nodes( const void* node ) const
     
    537535        transform t = nv::transform( nv::assimp_mat4_cast( node->mTransformation ) );
    538536
    539         nodes[ this_id ] = anode ? create_keys( anode, t ) : data_channel_set_creator::create_set( 0 );
    540 
    541         infos[this_id].name      = make_name( name );
    542         infos[this_id].parent_id = parent_id;
     537        nodes[ uint32( this_id ) ] = anode ? create_keys( anode, t ) : data_channel_set_creator::create_set( 0 );
     538        infos[ uint32( this_id ) ].name      = make_name( name );
     539        infos[ uint32( this_id ) ].parent_id = parent_id;
    543540        // This value is ignored by the create_transformed_keys, but needed by create_direct_keys!
    544541        // TODO: find a common solution!
  • trunk/src/formats/nmd_loader.cc

    r486 r487  
    6666{
    6767        if ( count == 0 ) return;
    68         source.seek( count * sizeof( nmd_attribute ), origin::CUR );
     68        source.seek( long( count * sizeof( nmd_attribute ) ), origin::CUR );
    6969}
    7070
     
    220220void nv::nmd_dump_bones( stream& stream_out, const data_node_list& nodes )
    221221{
    222         uint32 total = sizeof( nmd_animation_header );
    223         for ( auto node : nodes )
    224         {
    225                 total += sizeof( nmd_element_header );
    226         }
     222        uint32 total = sizeof( nmd_animation_header ) + sizeof( nmd_element_header ) * nodes.size();
    227223
    228224        nmd_element_header header;
Note: See TracChangeset for help on using the changeset viewer.