Changeset 487 for trunk/src


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

Legend:

Unmodified
Added
Removed
  • trunk/src/core/ascii_printer.cc

    r486 r487  
    2020        for ( char c : text )
    2121        {
    22                 m_terminal->print( coord, color, static_cast<unsigned char>( c ) );
     22                m_terminal->print( coord, color, c );
    2323                ++coord.x;
    2424                if ( coord.x >= m_terminal->get_size().x ) break;
  • trunk/src/core/io_event.cc

    r450 r487  
    6464        ;
    6565
    66         uint32 counter = 0;
    6766        db->create_type<io_event_code>()
    68 #       define NV_IO_EVENT( id ) .value( #id, counter++ )
     67#       define NV_IO_EVENT( id ) .value( #id, id )
    6968#               include <nv/detail/io_event_list.inc>
    7069#       undef NV_IO_EVENT
  • trunk/src/core/random.cc

    r471 r487  
    2222{
    2323        m_state[0] = static_cast<uint32>( seed & mt_full_mask );
    24         for ( int i = 1; i < mersenne_n; i++ )
     24        for ( uint32 i = 1; i < mersenne_n; i++ )
    2525        {
    2626                m_state[i]  = ( 1812433253UL * ( m_state[i - 1] ^ ( m_state[i - 1] >> 30 ) ) + i );
     
    7171
    7272random::random( random::seed_type seed /*= 0 */ )
    73         : m_remaining( 0 ), m_next( nullptr ), m_seeded( 0 )
     73        : m_next( nullptr ), m_remaining( 0 ), m_seeded( 0 )
    7474{
    7575        mt_init( seed == 0 ? randomized_seed() : seed );
  • trunk/src/curses/curses_terminal.cc

    r406 r487  
    5353}
    5454
    55 void curses_terminal::print( position p, uint32 color, unsigned char ch )
     55void curses_terminal::print( position p, uint32 color, char ch )
    5656{
    5757        m_update_needed = true;
     
    6464                attrset((static_cast<uint32>(color+1) << 24)  & 0xff000000ul);
    6565        }
    66         mvaddch( p.y-1, p.x-1, ch );
     66        mvaddch( p.y-1, p.x-1, chtype(ch) );
    6767        ::move( m_cursor.y-1, m_cursor.x-1 );
    6868}
  • trunk/src/engine/animation.cc

    r486 r487  
    6161                layer.def_state = -1;
    6262
    63                 if ( layer.mask != -1 )
     63                if ( layer.mask >= 0 )
    6464                {
    6565                        const auto& tree = animator->poses->get_tree();
    6666                        layer.mask_vector.resize( tree.size(), false );
    67                         fill_mask_vector_rec( layer.mask_vector, tree, layer.mask );
     67                        fill_mask_vector_rec( layer.mask_vector, tree, uint32( layer.mask ) );
    6868                }
    6969
  • 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;
  • trunk/src/gfx/image.cc

    r406 r487  
    2626        : m_size( size ), m_depth( depth ), m_data( nullptr )
    2727{
     28        NV_ASSERT( size.x >= 0 && size.y >= 0, "bad parameters passed to image!" );
    2829        sint32 bsize = m_size.x * m_size.y * static_cast<sint32>( m_depth );
    29         m_data = new uint8[ bsize ];
     30        m_data = new uint8[ size_t( bsize ) ];
    3031
    3132        if ( reversed )
  • trunk/src/gfx/mesh_creator.cc

    r482 r487  
    265265        delete[] tangents2;
    266266
    267         uint32 n_channel_index = m_data->get_channel_index( slot::NORMAL );
    268         data_channel_set_creator( m_data ).set_channel( n_channel_index, merge_channels( *m_nrm_channel, g_channel ) );
     267        int n_channel_index = m_data->get_channel_index( slot::NORMAL );
     268        NV_ASSERT( n_channel_index >= 0, "Normal channel not found!" );
     269        data_channel_set_creator( m_data ).set_channel( uint32( n_channel_index ), merge_channels( *m_nrm_channel, g_channel ) );
    269270        initialize();
    270271}
  • trunk/src/gfx/texture_font.cc

    r471 r487  
    8080static uint8* convert_to_rgba(uint8* rgb, const int lines, const int line_count, const int line_bpitch )
    8181{
    82         uint8* result = new uint8[ lines * line_count * 4 ];
     82        uint8* result = new uint8[ static_cast< uint32 >( lines * line_count * 4 ) ];
    8383        uint8* rgba   = result;
    8484        for(int l=0; l<lines; ++l)
  • trunk/src/gl/gl_context.cc

    r485 r487  
    216216                        glBindBufferBase( buffer_type_to_enum( info->type ), index, info->glid );
    217217                else
    218                         glBindBufferRange( buffer_type_to_enum( info->type ), index, info->glid, offset, size );
     218                        glBindBufferRange( buffer_type_to_enum( info->type ), index, info->glid, static_cast<GLintptr>( offset ), static_cast<GLsizeiptr>( size ) );
    219219        }
    220220}
     
    790790                else
    791791                {
    792                         glDrawArrays( primitive_to_enum(prim), first, static_cast<GLsizei>( count ) );
     792                        glDrawArrays( primitive_to_enum(prim), static_cast<GLint>( first ), static_cast<GLsizei>( count ) );
    793793                }
    794794                unbind( va );
  • trunk/src/gl/gl_device.cc

    r485 r487  
    358358        if ( info )
    359359        {
    360                 int result = glGetUniformBlockIndex( info->glid, name.data() );
    361                 if ( result >= 0 ) return result;
     360                GLuint result = glGetUniformBlockIndex( info->glid, name.data() );
     361                if ( result != GL_INVALID_INDEX ) return static_cast<int>( result );
    362362                if ( fatal )
    363363                {
     
    427427                if ( ubase->is_dirty() )
    428428                {
    429                         int uloc = ubase->get_location();
     429                        GLint   uloc = ubase->get_location();
     430                        GLsizei size = static_cast<GLsizei>( ubase->get_length() );
    430431                        switch( ubase->get_type() )
    431432                        {
    432                         case FLOAT          : glUniform1fv( uloc, ubase->get_length(), static_cast< uniform< enum_to_type< FLOAT >::type >*>( ubase )->get_value() ); break;
    433                         case INT            : glUniform1iv( uloc, ubase->get_length(), static_cast< uniform< enum_to_type< INT >::type >*>( ubase )->get_value() ); break;
    434                         case FLOAT_VECTOR_2 : glUniform2fv( uloc, ubase->get_length(), reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_VECTOR_2 >::type >*>( ubase )->get_value())); break;
    435                         case FLOAT_VECTOR_3 : glUniform3fv( uloc, ubase->get_length(), reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_VECTOR_3 >::type >*>( ubase )->get_value())); break;
    436                         case FLOAT_VECTOR_4 : glUniform4fv( uloc, ubase->get_length(), reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_VECTOR_4 >::type >*>( ubase )->get_value())); break;
    437                         case INT_VECTOR_2   : glUniform2iv( uloc, ubase->get_length(), reinterpret_cast<const GLint*>( static_cast< uniform< enum_to_type< INT_VECTOR_2 >::type >*>( ubase )->get_value())); break;
    438                         case INT_VECTOR_3   : glUniform3iv( uloc, ubase->get_length(), reinterpret_cast<const GLint*>( static_cast< uniform< enum_to_type< INT_VECTOR_3 >::type >*>( ubase )->get_value())); break;
    439                         case INT_VECTOR_4   : glUniform4iv( uloc, ubase->get_length(), reinterpret_cast<const GLint*>( static_cast< uniform< enum_to_type< INT_VECTOR_4 >::type >*>( ubase )->get_value())); break;
    440                         case FLOAT_MATRIX_2 : glUniformMatrix2fv( uloc, ubase->get_length(), GL_FALSE, reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_MATRIX_2 >::type >*>( ubase )->get_value())); break;
    441                         case FLOAT_MATRIX_3 : glUniformMatrix3fv( uloc, ubase->get_length(), GL_FALSE, reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_MATRIX_3 >::type >*>( ubase )->get_value())); break;
    442                         case FLOAT_MATRIX_4 : glUniformMatrix4fv( uloc, ubase->get_length(), GL_FALSE, reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_MATRIX_4 >::type >*>( ubase )->get_value())); break;
     433                        case FLOAT          : glUniform1fv( uloc, size, static_cast< uniform< enum_to_type< FLOAT >::type >*>( ubase )->get_value() ); break;
     434                        case INT            : glUniform1iv( uloc, size, static_cast< uniform< enum_to_type< INT >::type >*>( ubase )->get_value() ); break;
     435                        case FLOAT_VECTOR_2 : glUniform2fv( uloc, size, reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_VECTOR_2 >::type >*>( ubase )->get_value())); break;
     436                        case FLOAT_VECTOR_3 : glUniform3fv( uloc, size, reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_VECTOR_3 >::type >*>( ubase )->get_value())); break;
     437                        case FLOAT_VECTOR_4 : glUniform4fv( uloc, size, reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_VECTOR_4 >::type >*>( ubase )->get_value())); break;
     438                        case INT_VECTOR_2   : glUniform2iv( uloc, size, reinterpret_cast<const GLint*>( static_cast< uniform< enum_to_type< INT_VECTOR_2 >::type >*>( ubase )->get_value())); break;
     439                        case INT_VECTOR_3   : glUniform3iv( uloc, size, reinterpret_cast<const GLint*>( static_cast< uniform< enum_to_type< INT_VECTOR_3 >::type >*>( ubase )->get_value())); break;
     440                        case INT_VECTOR_4   : glUniform4iv( uloc, size, reinterpret_cast<const GLint*>( static_cast< uniform< enum_to_type< INT_VECTOR_4 >::type >*>( ubase )->get_value())); break;
     441                        case FLOAT_MATRIX_2 : glUniformMatrix2fv( uloc, size, GL_FALSE, reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_MATRIX_2 >::type >*>( ubase )->get_value())); break;
     442                        case FLOAT_MATRIX_3 : glUniformMatrix3fv( uloc, size, GL_FALSE, reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_MATRIX_3 >::type >*>( ubase )->get_value())); break;
     443                        case FLOAT_MATRIX_4 : glUniformMatrix4fv( uloc, size, GL_FALSE, reinterpret_cast<const GLfloat*>( static_cast< uniform< enum_to_type< FLOAT_MATRIX_4 >::type >*>( ubase )->get_value())); break;
    443444                        default : break; // error?
    444445                        }
     
    507508                }
    508509
    509                 uniform_base* u = uniform_base::create( utype, uni_loc, uni_len );
     510                uniform_base* u = uniform_base::create( utype, uni_loc, size_t( uni_len ) );
    510511                NV_ASSERT( u, "Unknown uniform type!" );
    511512                (*p->m_uniform_map)[ name ] = u;
  • trunk/src/gui/gui_ascii_renderer.cc

    r444 r487  
    1818        bool   clear;
    1919        bool   border;
    20         uchar8 border_chars[8];
     20        char  border_chars[8];
    2121        uint32 border_color;
    2222        uint32 text_color;
     
    6767                                er->border_color = uint32( border_color );
    6868                        for ( uint32 i = 0; i < 8 && i < path.length(); i++ )
    69                                 er->border_chars[i] = static_cast< uchar8 >( path[i] );
     69                                er->border_chars[i] = path[i];
    7070                }
    7171        }
     
    102102                for ( char c : e->m_text )
    103103                {
    104                         m_terminal->print( p, er->text_color, static_cast< unsigned char >( c ) );
     104                        m_terminal->print( p, er->text_color, c );
    105105                        ++p.x;
    106106                }
  • trunk/src/gui/gui_gfx_renderer.cc

    r472 r487  
    311311                }
    312312
    313                 e->m_text;
     313//              e->m_text;
    314314                if ( !e->m_text.empty() )
    315315                {
  • trunk/src/gui/gui_style.cc

    r448 r487  
    3333        if ( !resolve( e->m_id, e->m_class, cselector, centry, LUA_TTABLE ) ) return false;
    3434        vec = vec4();
    35         for ( int i = 0; i < 4; ++i )
     35        for ( size_t i = 0; i < 4; ++i )
    3636        {
    37                 lua_rawgeti( m_lua, -1, i+1 );
     37                lua_rawgeti( m_lua, -1, int(i+1) );
    3838                if ( lua_isnil( m_lua, -1 ) ) return true;
    3939                vec[i] = static_cast< float >( lua_tonumber( m_lua, -1 ) );
  • trunk/src/image/miniz.cc

    r486 r487  
    33
    44using namespace nv;
     5
     6#define MINIZ_NO_TIME
     7#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
     8
     9#define MINIZ_HAS_64BIT_REGISTERS 0
     10#define TINFL_USE_64BIT_BITBUF 0
     11
     12#if NV_COMPILER == NV_CLANG
     13#pragma clang diagnostic ignored "-Wunused-macros"
     14#pragma clang diagnostic ignored "-Wold-style-cast"
     15#pragma clang diagnostic ignored "-Wsign-conversion"
     16#endif
    517
    618#if defined( _M_IX86 ) || defined( _M_X64 ) || defined( __i386__ ) || defined( __i386 ) || defined( __i486__ ) || defined( __i486 ) || defined( i386 ) || defined( __ia64__ ) || defined( __x86_64__ )
  • trunk/src/image/png_loader.cc

    r486 r487  
    1010
    1111using namespace nv;
     12
     13#if NV_COMPILER == NV_CLANG
     14#pragma clang diagnostic ignored "-Wunused-macros"
     15#pragma clang diagnostic ignored "-Wold-style-cast"
     16#pragma clang diagnostic ignored "-Wsign-conversion"
     17#pragma clang diagnostic ignored "-Wreserved-id-macro"
     18#pragma clang diagnostic ignored "-Wmissing-prototypes"
     19#define NULL 0
     20#endif
    1221
    1322enum
     
    322331};
    323332
     333static int iabs( int a )
     334{
     335        return a < 0 ? -a : a;
     336}
     337
    324338static int stbi__paeth( int a, int b, int c )
    325339{
    326340        int p = a + b - c;
    327         int pa = abs( p - a );
    328         int pb = abs( p - b );
    329         int pc = abs( p - c );
     341        int pa = iabs( p - a );
     342        int pb = iabs( p - b );
     343        int pc = iabs( p - c );
    330344        if ( pa <= pb && pa <= pc ) return a;
    331345        if ( pb <= pc ) return b;
     
    10501064                case 3: format.format = RGB; break;
    10511065                case 4: format.format = RGBA; break;
    1052                 default: return false;
     1066                default: return nullptr;
    10531067                }
    10541068                size = ivec2( x, y );
  • trunk/src/io/c_stream.cc

    r486 r487  
    5050{
    5151        NV_ASSERT( buffer != nullptr && max_count != 0, "Bad parameter passed to write!" );
    52         char* result = ::fgets( buffer, max_count, reinterpret_cast<FILE*>( m_file ) );
     52        char* result = ::fgets( buffer, static_cast<int>( max_count ), reinterpret_cast<FILE*>( m_file ) );
    5353        if ( !result ) return false;
    5454        return true;
  • trunk/src/lib/gl.cc

    r466 r487  
    161161        if ( wgl_library_loaded ) return true;
    162162
    163         HGLRC (NV_GL_APIENTRY *wgl_createcontext) (HDC)        = nullptr;
    164         BOOL  (NV_GL_APIENTRY *wgl_makecurrent)   (HDC, HGLRC) = nullptr;
    165         BOOL  (NV_GL_APIENTRY *wgl_deletecontext) (HGLRC)      = nullptr;
     163        HGLRC ( NV_GL_APIENTRY *wgl_createcontext) (HDC)        = nullptr;
     164        BOOL  ( NV_GL_APIENTRY *wgl_makecurrent)   (HDC, HGLRC) = nullptr;
     165        BOOL  ( NV_GL_APIENTRY *wgl_deletecontext) (HGLRC)      = nullptr;
    166166
    167167        void_assign( wgl_createcontext, gl_library.get("wglCreateContext") );
  • trunk/src/lua/lua_math.cc

    r471 r487  
    1111#include "nv/stl/type_traits/common.hh"
    1212
    13 static int nlua_swizzel_lookup[256];
     13static size_t nlua_swizzel_lookup[256];
    1414
    1515using nv::lua::detail::is_vec;
     
    1818using nv::lua::detail::push_vec;
    1919
    20 inline bool nlua_is_swizzel( const unsigned char* str, int max )
     20inline bool nlua_is_swizzel( const unsigned char* str, size_t max )
    2121{
    2222        while (*str)
     
    279279        {
    280280                switch (len) {
    281                 case 2 : { vec2 v2 = to_vec<vec2>(L,3); for ( int i = 0; i<int( len ); ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v2[i]; } return 0;
    282                 case 3 : { vec3 v3 = to_vec<vec3>(L,3); for ( int i = 0; i<int( len ); ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v3[i]; } return 0;
    283                 case 4 : { vec4 v4 = to_vec<vec4>(L,3); for ( int i = 0; i<int( len ); ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v4[i]; } return 0;
     281                case 2 : { vec2 v2 = to_vec<vec2>(L,3); for ( size_t i = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v2[i]; } return 0;
     282                case 3 : { vec3 v3 = to_vec<vec3>(L,3); for ( size_t i = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v3[i]; } return 0;
     283                case 4 : { vec4 v4 = to_vec<vec4>(L,3); for ( size_t i = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v4[i]; } return 0;
    284284                default: break;
    285285                }
  • trunk/src/stl/assert.cc

    r440 r487  
    2828#       else // NV_COMPILER
    2929#       if NV_COMPILER == NV_CLANG
    30 extern "C" {
    31         extern void __assert(const char *, const char *, unsigned int, const char *) NV_NORETURN;
     30// extern "C" {
     31//      extern void __assert(const char *, const char *, unsigned int, const char *) NV_NORETURN;
     32// }
     33
     34int error_here;
     35static void __assert( const char *, const char *, unsigned int, const char * ) NV_NORETURN
     36{
     37        //no-op
    3238}
     39
    3340#define NV_ASSERT_IMPL __assert
    3441#       else
Note: See TracChangeset for help on using the changeset viewer.