Changeset 323 for trunk/src/formats


Ignore:
Timestamp:
08/26/14 04:03:10 (11 years ago)
Author:
epyon
Message:
  • nova now compiles again under all three compilers with -Winsane and no warnings
Location:
trunk/src/formats
Files:
4 edited

Legend:

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

    r302 r323  
    1414using namespace nv;
    1515
    16 const int MAX_BONES = 64;
     16const unsigned MAX_BONES = 64;
    1717
    1818struct assimp_plain_vtx
     
    9090        m_mesh_count = 0;
    9191        NV_LOG( nv::LOG_NOTICE, "AssImp loading file..." );
    92         int size = (int)source.size();
     92        size_t size = source.size();
    9393        char* data  = new char[ size ];
    9494        source.read( data, size, 1 );
     
    159159                                        if ( v.boneweight[i] <= 0.0f )
    160160                                        {
    161                                                 v.boneindex[i] = m;
     161                                                v.boneindex[i]  = (int)m;
    162162                                                v.boneweight[i] = bone->mWeights[w].mWeight;
    163163                                                found = true;
     
    289289        for ( unsigned int m = 0; m < m_mesh_count; ++m )
    290290        {
    291                 sint16 translate[MAX_BONES];
     291                uint16 translate[MAX_BONES];
    292292                std::vector< mesh_node_data > bones;
    293293                const aiMesh*  mesh  = scene->mMeshes[ m ];
     
    304304                                {
    305305                                        NV_ASSERT( final_bones.size() < MAX_BONES, "Too many bones to merge!" );
    306                                         sint16 index = (sint16)final_bones.size();
     306                                        uint16 index = (uint16)final_bones.size();
    307307                                        final_bones.push_back( bone );
    308308                                        names[ bone.name ] = index;
     
    311311                                else
    312312                                {
    313                                         translate[b] = (sint16)iname->second;
     313                                        translate[b] = iname->second;
    314314                                }
    315315                        }
     
    326326                                                if ( vertex.boneweight[i] > 0.0f )
    327327                                                {
    328                                                         vertex.boneindex[i] = translate[vertex.boneindex[i]];
     328                                                        vertex.boneindex[i] = (int)translate[vertex.boneindex[i]];
    329329                                                }
    330330                                        }
  • trunk/src/formats/md3_loader.cc

    r319 r323  
    234234
    235235md3_loader::md3_loader( bool merge_all )
    236         : m_md3( nullptr ), m_merge_all( merge_all )
     236        : m_merge_all( merge_all ), m_md3( nullptr )
    237237{
    238238        if ( !s_normal_ready )
     
    286286{
    287287        md3_t* md3 = (md3_t*)m_md3;
    288         key_raw_channel* result = key_raw_channel::create<md3_key>( md3->header.num_frames );
     288        key_raw_channel* result = key_raw_channel::create<md3_key>( (uint32)md3->header.num_frames );
    289289        // TODO: is this brain damaged in efficiency (loop nest order) or what?
    290290        for ( sint32 f = 0; f < md3->header.num_frames; ++f )
     
    322322{
    323323        mesh_data* data = new mesh_data;
    324         release_mesh_frame( data, -1, index );
     324        release_mesh_frame( data, -1, (sint32)index );
    325325        return data;
    326326}
     
    329329{
    330330        md3_t* md3 = (md3_t*)m_md3;
    331         sint32 num_surfaces  = md3->header.num_surfaces;
    332         sint32 num_verts     = 0;
    333         sint32 current_frame = ( frame == -1 ? 0 : frame );
    334         sint32 frame_count   = ( frame == -1 ? md3->header.num_frames : 1 );
    335         sint32 current_surf  = ( surface == -1 ? 0 : surface );
    336         sint32 surf_count    = ( surface == -1 ? md3->header.num_surfaces : 1 );
    337         sint32 index_count   = 0;
     331        uint32 num_surfaces  = (uint32)md3->header.num_surfaces;
     332        uint32 num_verts     = 0;
     333        uint32 current_frame = ( frame == -1 ? 0 : (uint32)frame );
     334        uint32 frame_count   = ( frame == -1 ? (uint32)md3->header.num_frames : 1 );
     335        uint32 current_surf  = ( surface == -1 ? 0 : (uint32)surface );
     336        uint32 surf_count    = ( surface == -1 ? (uint32)md3->header.num_surfaces : 1 );
     337        uint32 index_count   = 0;
    338338
    339339        if ( surface >= 0 )
    340340        {
    341                 index_count = md3->surfaces[surface].header.num_triangles * 3;
    342                 num_verts   = md3->surfaces[surface].header.num_verts;
     341                index_count = (uint32)md3->surfaces[(uint32)surface].header.num_triangles * 3;
     342                num_verts   = (uint32)md3->surfaces[(uint32)surface].header.num_verts;
    343343        }
    344344        else
    345                 for ( sint32 i = 0; i < num_surfaces; ++i )
    346                 {
    347                         index_count += md3->surfaces[i].header.num_triangles * 3;
    348                         num_verts   += md3->surfaces[i].header.num_verts;
     345                for ( uint32 i = 0; i < num_surfaces; ++i )
     346                {
     347                        index_count += (uint32)md3->surfaces[i].header.num_triangles * 3;
     348                        num_verts   += (uint32)md3->surfaces[i].header.num_verts;
    349349                }
    350350
     
    362362        while ( surf_count > 0 )
    363363        {
    364                 const md3_surface_t& surface = md3->surfaces[ current_surf ];
    365                 const uint32         vcount  = static_cast< uint32 >( surface.header.num_verts );
    366                 const uint32         tcount  = static_cast< uint32 >( surface.header.num_triangles );
     364                const md3_surface_t& sface = md3->surfaces[ current_surf ];
     365                const uint32         vcount = static_cast< uint32 >( sface.header.num_verts );
     366                const uint32         tcount = static_cast< uint32 >( sface.header.num_triangles );
    367367
    368368                for (uint32 j = 0; j < vcount; ++j )
    369369                {
    370                         vtx_t[index++].texcoord = md3_texcoord( surface.st[j] );
     370                        vtx_t[index++].texcoord = md3_texcoord( sface.st[j] );
    371371                }
    372372
    373373                for (size_t j = 0; j < tcount; ++j )
    374374                {
    375                         const md3_triangle_t& t = surface.triangles[j];
     375                        const md3_triangle_t& t = sface.triangles[j];
    376376                        icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[0] );
    377377                        icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[1] );
    378378                        icp[iindex++] = static_cast< uint16 >( index_base + t.indexes[2] );
    379379                }
    380                 index_base += surface.header.num_verts;
     380                index_base += sface.header.num_verts;
    381381                ++current_surf;
    382382                --surf_count;
     
    386386        while ( frame_count > 0 )
    387387        {
    388                 current_surf  = ( surface == -1 ? 0 : surface );
    389                 surf_count    = ( surface == -1 ? md3->header.num_surfaces : 1 );
     388                current_surf  = ( surface == -1 ? 0 : (uint32)surface );
     389                surf_count    = ( surface == -1 ? (uint32)md3->header.num_surfaces : 1 );
    390390
    391391                while ( surf_count > 0 )
    392392                {
    393                         md3_surface_t& surface = md3->surfaces[current_surf];
    394                         sint32         vcount  = surface.header.num_verts;
    395                         sint32         offset = vcount * current_frame;
    396                         sint32         limit   = vcount + offset;
    397                         for (sint32 j = offset; j < limit; ++j )
     393                        md3_surface_t& sface = md3->surfaces[current_surf];
     394                        uint32         vcount = (uint32)sface.header.num_verts;
     395                        uint32         offset = vcount * current_frame;
     396                        uint32         limit  = vcount + offset;
     397                        for (uint32 j = offset; j < limit; ++j )
    398398                        {
    399                                 md3_vertex_t& v = surface.vertices[j];
     399                                md3_vertex_t& v = sface.vertices[j];
    400400                                vtx_pn[index].position = vec3( v.x * MD3_XYZ_SCALE, v.z * MD3_XYZ_SCALE, v.y * MD3_XYZ_SCALE );
    401401                                vtx_pn[index].normal   = s_normal_cache[ v.normal ];
     
    418418{
    419419        md3_t* md3 = (md3_t*)m_md3;
    420         uint32 node_count = md3->header.num_tags;
     420        uint32 node_count = (uint32)md3->header.num_tags;
    421421        if ( node_count == 0 ) return nullptr;;
    422422        mesh_node_data* nodes = new mesh_node_data[ node_count ];
     
    451451        else
    452452        {
    453                 count = md3->header.num_surfaces;
     453                count = (uint32)md3->header.num_surfaces;
    454454                data = new mesh_data[ count ];
    455455                for ( uint32 i = 0; i < count; ++i )
    456456                {
    457                         release_mesh_frame( &data[i], -1, i );
     457                        release_mesh_frame( &data[i], -1, (sint32)i );
    458458                        data[i].set_name( (char*)md3->surfaces[i].header.name );
    459459                }
  • trunk/src/formats/md5_loader.cc

    r319 r323  
    135135                        mesh_data* mesh = new mesh_data("md5_mesh");
    136136
    137                         int num_verts   = 0;
    138                         int num_tris    = 0;
    139                         int num_weights = 0;
     137                        uint32 num_verts   = 0;
     138                        uint32 num_tris    = 0;
     139                        uint32 num_weights = 0;
    140140
    141141                        discard( sstream, "{" );
     
    170170                                        next_line( sstream );
    171171                                        std::string line;
    172                                         for ( int i = 0; i < num_verts; ++i )
     172                                        for ( uint32 i = 0; i < num_verts; ++i )
    173173                                        {
    174174                                                size_t weight_count;
     
    194194                                        next_line( sstream );
    195195                                        std::string line;
    196                                         for ( int i = 0; i < num_tris; ++i )
     196                                        for ( uint32 i = 0; i < num_tris; ++i )
    197197                                        {
    198198                                                size_t ti0;
     
    214214                                        next_line( sstream );
    215215                                        std::string line;
    216                                         for ( int i = 0; i < num_weights; ++i )
     216                                        for ( uint32 i = 0; i < num_weights; ++i )
    217217                                        {
    218218                                                md5_weight weight;
     
    368368                        if ( j < weight_count )
    369369                        {
    370                                 vdata.boneindex[j]  = weights[start_weight + j].joint_id;
     370                                vdata.boneindex[j]  = (int)weights[start_weight + j].joint_id;
    371371                                vdata.boneweight[j] = weights[start_weight + j].bias;
    372372                        }
  • trunk/src/formats/nmd_loader.cc

    r319 r323  
    242242
    243243                nmd_node_header nheader;
    244                 nheader.parent_id = (uint16)node->parent_id;
     244                nheader.parent_id = node->parent_id;
    245245                nheader.transform = node->transform;
    246246                stream_out.write( &nheader, sizeof( nheader ), 1 );
Note: See TracChangeset for help on using the changeset viewer.