- Timestamp:
- 03/08/16 08:05:51 (9 years ago)
- Location:
- trunk/src
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/ascii_printer.cc
r486 r487 20 20 for ( char c : text ) 21 21 { 22 m_terminal->print( coord, color, static_cast<unsigned char>( c ));22 m_terminal->print( coord, color, c ); 23 23 ++coord.x; 24 24 if ( coord.x >= m_terminal->get_size().x ) break; -
trunk/src/core/io_event.cc
r450 r487 64 64 ; 65 65 66 uint32 counter = 0;67 66 db->create_type<io_event_code>() 68 # define NV_IO_EVENT( id ) .value( #id, counter++)67 # define NV_IO_EVENT( id ) .value( #id, id ) 69 68 # include <nv/detail/io_event_list.inc> 70 69 # undef NV_IO_EVENT -
trunk/src/core/random.cc
r471 r487 22 22 { 23 23 m_state[0] = static_cast<uint32>( seed & mt_full_mask ); 24 for ( inti = 1; i < mersenne_n; i++ )24 for ( uint32 i = 1; i < mersenne_n; i++ ) 25 25 { 26 26 m_state[i] = ( 1812433253UL * ( m_state[i - 1] ^ ( m_state[i - 1] >> 30 ) ) + i ); … … 71 71 72 72 random::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 ) 74 74 { 75 75 mt_init( seed == 0 ? randomized_seed() : seed ); -
trunk/src/curses/curses_terminal.cc
r406 r487 53 53 } 54 54 55 void curses_terminal::print( position p, uint32 color, unsignedchar ch )55 void curses_terminal::print( position p, uint32 color, char ch ) 56 56 { 57 57 m_update_needed = true; … … 64 64 attrset((static_cast<uint32>(color+1) << 24) & 0xff000000ul); 65 65 } 66 mvaddch( p.y-1, p.x-1, ch );66 mvaddch( p.y-1, p.x-1, chtype(ch) ); 67 67 ::move( m_cursor.y-1, m_cursor.x-1 ); 68 68 } -
trunk/src/engine/animation.cc
r486 r487 61 61 layer.def_state = -1; 62 62 63 if ( layer.mask != -1)63 if ( layer.mask >= 0 ) 64 64 { 65 65 const auto& tree = animator->poses->get_tree(); 66 66 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 ) ); 68 68 } 69 69 -
trunk/src/formats/assimp_loader.cc
r486 r487 215 215 { 216 216 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++) 218 218 { 219 219 assimp_skinned_vtx& v = vtx[ bone->mWeights[w].mVertexId ]; 220 220 bool found = false; 221 for ( int i = 0 ; i < 4; ++i )221 for ( size_t i = 0 ; i < 4; ++i ) 222 222 { 223 223 if ( v.boneweight[i] <= 0.0f ) … … 409 409 { 410 410 assimp_skinned_vtx& vertex = channel.data()[v]; 411 for ( int i = 0; i < 4; ++i )411 for ( size_t i = 0; i < 4; ++i ) 412 412 { 413 413 if ( vertex.boneweight[i] > 0.0f ) … … 429 429 mat4 tr = nv::math::inverse( assimp_mat4_cast( m_data->node_by_name[bone_data[i].name]->mTransformation ) ); 430 430 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; 433 433 else 434 434 bone_data[i].transform = tr; … … 492 492 { 493 493 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 } 498 496 499 497 void nv::assimp_loader::scan_nodes( const void* node ) const … … 537 535 transform t = nv::transform( nv::assimp_mat4_cast( node->mTransformation ) ); 538 536 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; 543 540 // This value is ignored by the create_transformed_keys, but needed by create_direct_keys! 544 541 // TODO: find a common solution! -
trunk/src/formats/nmd_loader.cc
r486 r487 66 66 { 67 67 if ( count == 0 ) return; 68 source.seek( count * sizeof( nmd_attribute), origin::CUR );68 source.seek( long( count * sizeof( nmd_attribute ) ), origin::CUR ); 69 69 } 70 70 … … 220 220 void nv::nmd_dump_bones( stream& stream_out, const data_node_list& nodes ) 221 221 { 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(); 227 223 228 224 nmd_element_header header; -
trunk/src/gfx/image.cc
r406 r487 26 26 : m_size( size ), m_depth( depth ), m_data( nullptr ) 27 27 { 28 NV_ASSERT( size.x >= 0 && size.y >= 0, "bad parameters passed to image!" ); 28 29 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 ) ]; 30 31 31 32 if ( reversed ) -
trunk/src/gfx/mesh_creator.cc
r482 r487 265 265 delete[] tangents2; 266 266 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 ) ); 269 270 initialize(); 270 271 } -
trunk/src/gfx/texture_font.cc
r471 r487 80 80 static uint8* convert_to_rgba(uint8* rgb, const int lines, const int line_count, const int line_bpitch ) 81 81 { 82 uint8* result = new uint8[ lines * line_count * 4];82 uint8* result = new uint8[ static_cast< uint32 >( lines * line_count * 4 ) ]; 83 83 uint8* rgba = result; 84 84 for(int l=0; l<lines; ++l) -
trunk/src/gl/gl_context.cc
r485 r487 216 216 glBindBufferBase( buffer_type_to_enum( info->type ), index, info->glid ); 217 217 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 ) ); 219 219 } 220 220 } … … 790 790 else 791 791 { 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 ) ); 793 793 } 794 794 unbind( va ); -
trunk/src/gl/gl_device.cc
r485 r487 358 358 if ( info ) 359 359 { 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 ); 362 362 if ( fatal ) 363 363 { … … 427 427 if ( ubase->is_dirty() ) 428 428 { 429 int uloc = ubase->get_location(); 429 GLint uloc = ubase->get_location(); 430 GLsizei size = static_cast<GLsizei>( ubase->get_length() ); 430 431 switch( ubase->get_type() ) 431 432 { 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; 443 444 default : break; // error? 444 445 } … … 507 508 } 508 509 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 ) ); 510 511 NV_ASSERT( u, "Unknown uniform type!" ); 511 512 (*p->m_uniform_map)[ name ] = u; -
trunk/src/gui/gui_ascii_renderer.cc
r444 r487 18 18 bool clear; 19 19 bool border; 20 uchar8border_chars[8];20 char border_chars[8]; 21 21 uint32 border_color; 22 22 uint32 text_color; … … 67 67 er->border_color = uint32( border_color ); 68 68 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]; 70 70 } 71 71 } … … 102 102 for ( char c : e->m_text ) 103 103 { 104 m_terminal->print( p, er->text_color, static_cast< unsigned char >( c ));104 m_terminal->print( p, er->text_color, c ); 105 105 ++p.x; 106 106 } -
trunk/src/gui/gui_gfx_renderer.cc
r472 r487 311 311 } 312 312 313 e->m_text;313 // e->m_text; 314 314 if ( !e->m_text.empty() ) 315 315 { -
trunk/src/gui/gui_style.cc
r448 r487 33 33 if ( !resolve( e->m_id, e->m_class, cselector, centry, LUA_TTABLE ) ) return false; 34 34 vec = vec4(); 35 for ( int i = 0; i < 4; ++i )35 for ( size_t i = 0; i < 4; ++i ) 36 36 { 37 lua_rawgeti( m_lua, -1, i +1);37 lua_rawgeti( m_lua, -1, int(i+1) ); 38 38 if ( lua_isnil( m_lua, -1 ) ) return true; 39 39 vec[i] = static_cast< float >( lua_tonumber( m_lua, -1 ) ); -
trunk/src/image/miniz.cc
r486 r487 3 3 4 4 using 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 5 17 6 18 #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 10 10 11 11 using 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 12 21 13 22 enum … … 322 331 }; 323 332 333 static int iabs( int a ) 334 { 335 return a < 0 ? -a : a; 336 } 337 324 338 static int stbi__paeth( int a, int b, int c ) 325 339 { 326 340 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 ); 330 344 if ( pa <= pb && pa <= pc ) return a; 331 345 if ( pb <= pc ) return b; … … 1050 1064 case 3: format.format = RGB; break; 1051 1065 case 4: format.format = RGBA; break; 1052 default: return false;1066 default: return nullptr; 1053 1067 } 1054 1068 size = ivec2( x, y ); -
trunk/src/io/c_stream.cc
r486 r487 50 50 { 51 51 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 ) ); 53 53 if ( !result ) return false; 54 54 return true; -
trunk/src/lib/gl.cc
r466 r487 161 161 if ( wgl_library_loaded ) return true; 162 162 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; 166 166 167 167 void_assign( wgl_createcontext, gl_library.get("wglCreateContext") ); -
trunk/src/lua/lua_math.cc
r471 r487 11 11 #include "nv/stl/type_traits/common.hh" 12 12 13 static int nlua_swizzel_lookup[256];13 static size_t nlua_swizzel_lookup[256]; 14 14 15 15 using nv::lua::detail::is_vec; … … 18 18 using nv::lua::detail::push_vec; 19 19 20 inline bool nlua_is_swizzel( const unsigned char* str, int max )20 inline bool nlua_is_swizzel( const unsigned char* str, size_t max ) 21 21 { 22 22 while (*str) … … 279 279 { 280 280 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; 284 284 default: break; 285 285 } -
trunk/src/stl/assert.cc
r440 r487 28 28 # else // NV_COMPILER 29 29 # 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 34 int error_here; 35 static void __assert( const char *, const char *, unsigned int, const char * ) NV_NORETURN 36 { 37 //no-op 32 38 } 39 33 40 #define NV_ASSERT_IMPL __assert 34 41 # else
Note: See TracChangeset
for help on using the changeset viewer.