- Timestamp:
- 06/15/13 17:47:57 (12 years ago)
- Location:
- trunk/src
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gfx/image.cc
r90 r121 12 12 : m_size( size ), m_depth( depth ), m_data( nullptr ) 13 13 { 14 m_data = new uint8[ m_size.x * m_size.y* m_depth ];14 m_data = new uint8[ static_cast<uint16>( m_size.x * m_size.y ) * m_depth ]; 15 15 } 16 16 … … 25 25 : m_size( size ), m_depth( depth ), m_data( nullptr ) 26 26 { 27 s td::size_t bsize = m_size.x * m_size.y * m_depth;28 m_data = new uint8[ m_size.x * m_size.y * m_depth];27 sint32 bsize = m_size.x * m_size.y * static_cast<sint32>( m_depth ); 28 m_data = new uint8[ bsize ]; 29 29 30 30 if ( reversed ) 31 31 { 32 s td::size_t bline = m_size.x * m_depth;32 sint32 bline = m_size.x * static_cast<sint32>( m_depth ); 33 33 for( int i = 0; i < m_size.y; ++i ) 34 34 { … … 45 45 void image::fill( uint8 value ) 46 46 { 47 std::fill( m_data, m_data + m_size.x * m_size.y * m_depth, value );47 std::fill( m_data, m_data + m_size.x * m_size.y * (int)m_depth, value ); 48 48 } 49 49 50 void image::set_region( region r, const uint8 * data, size_t stride )50 void image::set_region( region r, const uint8 * data, int stride ) 51 51 { 52 if ( stride == 0 ) stride = r.size.x * m_depth;52 if ( stride == 0 ) stride = r.size.x * static_cast<sint32>( m_depth ); 53 53 54 s td::size_t bpos = (r.pos.y*m_size.x + r.pos.x ) * m_depth;55 s td::size_t bline = m_size.x*m_depth;54 sint32 bpos = (r.pos.y*m_size.x + r.pos.x ) * static_cast<sint32>( m_depth ); 55 sint32 bline = m_size.x*static_cast<sint32>( m_depth ); 56 56 57 57 for( int i = 0; i < r.size.y; ++i ) -
trunk/src/gfx/texture_atlas.cc
r89 r121 37 37 { 38 38 best_height = y + size.y; 39 best_index = i;39 best_index = static_cast<int>( i ); 40 40 best_width = node.z; 41 41 r.pos.x = node.x; … … 52 52 m_nodes.insert( m_nodes.begin() + best_index, glm::ivec3( r.pos.x, r.pos.y + size.y, size.x ) ); 53 53 54 for( size_t i = best_index+1; i < m_nodes.size(); ++i )54 for( size_t i = static_cast<size_t>( best_index )+1; i < m_nodes.size(); ++i ) 55 55 { 56 56 glm::ivec3 node = m_nodes[ i ]; … … 65 65 if (m_nodes[ i ].z <= 0) 66 66 { 67 m_nodes.erase( m_nodes.begin() + i);67 m_nodes.erase( m_nodes.begin() + static_cast<int>(i) ); 68 68 --i; 69 69 } … … 79 79 } 80 80 merge(); 81 m_used += s ize.x * size.y;81 m_used += static_cast<uint16>(size.x * size.y); 82 82 return r; 83 83 } … … 119 119 { 120 120 m_nodes[ i ].z += m_nodes[ i+1 ].z; 121 m_nodes.erase( m_nodes.begin()+ i+1);121 m_nodes.erase( m_nodes.begin()+static_cast<int>(i+1) ); 122 122 --i; 123 123 } -
trunk/src/gfx/texture_font.cc
r114 r121 17 17 } 18 18 19 float texture_glyph::get_kerning( const uint16 charcode)19 float texture_glyph::get_kerning( const uint16 other ) 20 20 { 21 auto i = kerning.find( charcode);21 auto i = kerning.find( other ); 22 22 return i != kerning.end() ? i->second : 0.0f; 23 23 } … … 118 118 } 119 119 120 for ( char c : codes )120 for ( char ch : codes ) 121 121 { 122 uint16 c = static_cast<uint16>( ch ); 122 123 FT_UInt glyph_index = FT_Get_Char_Index( face, c ); 123 124 FT_Error error = FT_Load_Glyph( face, glyph_index, flags ); … … 136 137 int ft_glyph_top = slot->bitmap_top; 137 138 int ft_glyph_left = slot->bitmap_left; 138 int reg_width = ft_bitmap_width / (depth > 3 ? 3 : depth);139 int reg_width = ft_bitmap_width / (depth > 3 ? 3 : (int)depth); 139 140 140 141 glm::ivec2 gsize( reg_width + 1, ft_bitmap_rows + 1 ); -
trunk/src/gl/gl_context.cc
r116 r121 83 83 } 84 84 85 void gl_context::apply_stencil_face( intface, stencil_test_face& stencil, const stencil_test_face& new_stencil )85 void gl_context::apply_stencil_face( unsigned face, stencil_test_face& stencil, const stencil_test_face& new_stencil ) 86 86 { 87 87 if (( stencil.op_fail != new_stencil.op_fail ) || … … 317 317 } 318 318 319 void gl_context::force_apply_stencil_face( intface, const stencil_test_face& stencil )319 void gl_context::force_apply_stencil_face( unsigned face, const stencil_test_face& stencil ) 320 320 { 321 321 glStencilOpSeparate( face, … … 356 356 } 357 357 358 void gl_context::draw( primitive prim, const render_state& rs, program* p, vertex_array* va, int count )358 void gl_context::draw( primitive prim, const render_state& rs, program* p, vertex_array* va, size_t count ) 359 359 { 360 360 apply_render_state( rs ); … … 365 365 if ( va->has_index_buffer() ) 366 366 { 367 glDrawElements( primitive_to_enum(prim), count, datatype_to_gl_enum( va->get_index_buffer_type() ), 0 );367 glDrawElements( primitive_to_enum(prim), static_cast<GLsizei>( count ), datatype_to_gl_enum( va->get_index_buffer_type() ), 0 ); 368 368 } 369 369 else 370 370 { 371 glDrawArrays( primitive_to_enum(prim), 0, count);371 glDrawArrays( primitive_to_enum(prim), 0, static_cast<GLsizei>( count ) ); 372 372 } 373 373 va->unbind(); -
trunk/src/gl/gl_device.cc
r120 r121 53 53 } 54 54 55 vertex_buffer* gl_device::create_vertex_buffer( buffer_hint hint, int size, void* source /*= nullptr */ )55 vertex_buffer* gl_device::create_vertex_buffer( buffer_hint hint, size_t size, void* source /*= nullptr */ ) 56 56 { 57 57 return new gl_vertex_buffer( hint, size, source ); 58 58 } 59 59 60 index_buffer* gl_device::create_index_buffer( buffer_hint hint, int size, void* source /*= nullptr */ )60 index_buffer* gl_device::create_index_buffer( buffer_hint hint, size_t size, void* source /*= nullptr */ ) 61 61 { 62 62 return new gl_index_buffer( hint, size, source ); -
trunk/src/gl/gl_enum.cc
r70 r121 30 30 case depth_test::GREATER_OR_EQUAL : return GL_GEQUAL; 31 31 case depth_test::ALWAYS : return GL_ALWAYS; 32 default : return 0; // TODO: throw!32 NV_RETURN_COVERED_DEFAULT( 0 ); 33 33 } 34 34 } … … 53 53 case blending::ONE_MINUS_CONSTANT_ALPHA: return GL_ONE_MINUS_CONSTANT_ALPHA; 54 54 case blending::SRC_ALPHA_SATURATE : return GL_SRC_ALPHA_SATURATE; 55 default : return 0; // TODO: throw!55 NV_RETURN_COVERED_DEFAULT( 0 ); 56 56 } 57 57 } … … 66 66 case blending::MINIMUM : return GL_MIN; 67 67 case blending::MAXIMUM : return GL_MAX; 68 default : return 0; // TODO: throw!68 NV_RETURN_COVERED_DEFAULT( 0 ); 69 69 } 70 70 } … … 77 77 case culling::BACK : return GL_BACK; 78 78 case culling::FRONT_AND_BACK : return GL_FRONT_AND_BACK; 79 default : return 0; // TODO: throw!79 NV_RETURN_COVERED_DEFAULT( 0 ); 80 80 } 81 81 } … … 87 87 case culling::CW : return GL_CW; 88 88 case culling::CCW : return GL_CCW; 89 default : return 0; // TODO: throw!89 NV_RETURN_COVERED_DEFAULT( 0 ); 90 90 } 91 91 } … … 103 103 case stencil_test_face::GREATER_OR_EQUAL : return GL_GEQUAL; 104 104 case stencil_test_face::ALWAYS : return GL_ALWAYS; 105 default : return 0; // TODO: throw!105 NV_RETURN_COVERED_DEFAULT( 0 ); 106 106 } 107 107 } … … 119 119 case stencil_test_face::INCREMENT_WRAP : return GL_INCR_WRAP; 120 120 case stencil_test_face::DECREMENT_WRAP : return GL_DECR_WRAP; 121 default : return 0; // TODO: throw!121 NV_RETURN_COVERED_DEFAULT( 0 ); 122 122 } 123 123 } … … 130 130 case STREAM_DRAW : return GL_STREAM_DRAW; 131 131 case DYNAMIC_DRAW : return GL_DYNAMIC_DRAW; 132 default : return 0; // TODO: throw!132 NV_RETURN_COVERED_DEFAULT( 0 ); 133 133 } 134 134 } … … 140 140 case RGB : return GL_RGB; 141 141 case RGBA : return GL_RGBA; 142 default : return 0; // TODO: throw!142 NV_RETURN_COVERED_DEFAULT( 0 ); 143 143 } 144 144 } … … 154 154 case sampler::NEAREST_MIPMAP_LINEAR : return GL_NEAREST_MIPMAP_LINEAR; 155 155 case sampler::LINEAR_MIPMAP_LINEAR : return GL_LINEAR_MIPMAP_LINEAR; 156 default : return 0; // TODO: throw!156 NV_RETURN_COVERED_DEFAULT( 0 ); 157 157 } 158 158 } … … 166 166 case sampler::MIRRORED_REPEAT : return GL_MIRRORED_REPEAT; 167 167 case sampler::REPEAT : return GL_REPEAT; 168 default : return 0; // TODO: throw!168 NV_RETURN_COVERED_DEFAULT( 0 ); 169 169 } 170 170 } … … 181 181 case TRIANGLE_STRIP : return GL_TRIANGLE_STRIP; 182 182 case TRIANGLE_FAN : return GL_TRIANGLE_FAN; 183 default : return 0; // TODO: throw!183 NV_RETURN_COVERED_DEFAULT( 0 ); 184 184 } 185 185 } … … 209 209 case BYTE_VECTOR_3 : return GL_INT_VEC3; 210 210 case BYTE_VECTOR_4 : return GL_INT_VEC4; 211 default : return 0; // TODO: throw!211 NV_RETURN_COVERED_DEFAULT( 0 ); 212 212 } 213 213 } -
trunk/src/gl/gl_program.cc
r70 r121 14 14 using namespace nv; 15 15 16 gl_shader::gl_shader( uint32 sh ader_type )17 : object_id(0), shader_type( shader_type)16 gl_shader::gl_shader( uint32 sh_type ) 17 : shader_type( sh_type ), object_id(0) 18 18 { 19 19 // no op 20 20 } 21 21 22 gl_shader::gl_shader( uint32 sh ader_type, const string& shader_code )23 : object_id(0), shader_type( shader_type)22 gl_shader::gl_shader( uint32 sh_type, const string& shader_code ) 23 : shader_type( sh_type ), object_id(0) 24 24 { 25 25 compile( shader_code ); … … 140 140 glGetProgramiv( m_name.get_value(), GL_ACTIVE_ATTRIBUTES, ¶ms ); 141 141 142 for ( int i = 0; i <params; ++i )142 for ( unsigned i = 0; i < (unsigned)params; ++i ) 143 143 { 144 144 int attr_nlen; … … 149 149 glGetActiveAttrib( m_name.get_value(), i, 128, &attr_nlen, &attr_len, &attr_type, name_buffer ); 150 150 151 string name( name_buffer, attr_nlen);151 string name( name_buffer, size_t(attr_nlen) ); 152 152 153 153 // skip built-ins … … 165 165 glGetProgramiv( m_name.get_value(), GL_ACTIVE_UNIFORMS, ¶ms ); 166 166 167 for ( int i = 0; i < params; ++i )167 for ( unsigned i = 0; i < size_t(params); ++i ) 168 168 { 169 169 int uni_nlen; … … 174 174 glGetActiveUniform( m_name.get_value(), i, 128, &uni_nlen, &uni_len, &uni_type, name_buffer ); 175 175 176 string name( name_buffer, uni_nlen);176 string name( name_buffer, size_t(uni_nlen) ); 177 177 178 178 // skip built-ins … … 206 206 case FLOAT_MATRIX_3 : glUniformMatrix3fv( uloc, 1, GL_FALSE, glm::value_ptr(((uniform< enum_to_type< FLOAT_MATRIX_3 >::type >*)( ubase ))->get_value()) ); break; 207 207 case FLOAT_MATRIX_4 : glUniformMatrix4fv( uloc, 1, GL_FALSE, glm::value_ptr(((uniform< enum_to_type< FLOAT_MATRIX_4 >::type >*)( ubase ))->get_value()) ); break; 208 //default :error?208 default : break; // error? 209 209 } 210 210 ubase->clean(); -
trunk/src/gl/gl_texture2d.cc
r70 r121 15 15 glBindTexture( GL_TEXTURE_2D, m_name.get_value() ); 16 16 17 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nv::sampler_filter_to_enum( m_sampler.filter_min ) );18 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nv::sampler_filter_to_enum( m_sampler.filter_max ) );19 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, nv::sampler_wrap_to_enum( m_sampler.wrap_s) );20 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, nv::sampler_wrap_to_enum( m_sampler.wrap_t) );17 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (int)nv::sampler_filter_to_enum( m_sampler.filter_min ) ); 18 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (int)nv::sampler_filter_to_enum( m_sampler.filter_max ) ); 19 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, (int)nv::sampler_wrap_to_enum( m_sampler.wrap_s) ); 20 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, (int)nv::sampler_wrap_to_enum( m_sampler.wrap_t) ); 21 21 22 22 glBindTexture( GL_TEXTURE_2D, 0 ); … … 31 31 { 32 32 glBindTexture( GL_TEXTURE_2D, m_name.get_value() ); 33 glTexImage2D( GL_TEXTURE_2D, 0, nv::image_format_to_enum(m_format), m_size.x, m_size.y, 0, nv::image_format_to_enum(m_format), nv::datatype_to_gl_enum(m_datatype), data );33 glTexImage2D( GL_TEXTURE_2D, 0, (GLint)nv::image_format_to_enum(m_format), m_size.x, m_size.y, 0, nv::image_format_to_enum(m_format), nv::datatype_to_gl_enum(m_datatype), data ); 34 34 glBindTexture( GL_TEXTURE_2D, 0 ); 35 35 } 36 36 37 void nv::gl_texture2d::bind( int slot )37 void nv::gl_texture2d::bind( size_t slot ) 38 38 { 39 39 glActiveTexture( GL_TEXTURE0 + slot ); -
trunk/src/gl/gl_vertex_buffer.cc
r116 r121 10 10 using namespace nv; 11 11 12 gl_vertex_buffer::gl_vertex_buffer( buffer_hint hint, int size, void* data )12 gl_vertex_buffer::gl_vertex_buffer( buffer_hint hint, size_t size, void* data ) 13 13 : vertex_buffer( hint, size ), m_name() 14 14 { 15 15 bind(); 16 glBufferData( GL_ARRAY_BUFFER, m_size, data, buffer_hint_to_enum( m_hint ) );16 glBufferData( GL_ARRAY_BUFFER, (GLsizeiptr)m_size, data, buffer_hint_to_enum( m_hint ) ); 17 17 unbind(); 18 18 } 19 19 20 void gl_vertex_buffer::update( void* data, int offset, int size )20 void gl_vertex_buffer::update( void* data, size_t offset, size_t size ) 21 21 { 22 glBufferSubData( GL_ARRAY_BUFFER, offset,size, data );22 glBufferSubData( GL_ARRAY_BUFFER, (GLintptr)offset, (GLsizeiptr)size, data ); 23 23 } 24 24 … … 39 39 } 40 40 41 gl_index_buffer::gl_index_buffer( buffer_hint hint, int size, void* data )41 gl_index_buffer::gl_index_buffer( buffer_hint hint, size_t size, void* data ) 42 42 : index_buffer( hint, size ), m_name() 43 43 { 44 44 bind(); 45 glBufferData( GL_ELEMENT_ARRAY_BUFFER, m_size, data, buffer_hint_to_enum( m_hint ) );45 glBufferData( GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)m_size, data, buffer_hint_to_enum( m_hint ) ); 46 46 unbind(); 47 47 } 48 48 49 void gl_index_buffer::update( void* data, int offset, int size )49 void gl_index_buffer::update( void* data, size_t offset, size_t size ) 50 50 { 51 glBufferSubData( GL_ELEMENT_ARRAY_BUFFER, offset,size, data );51 glBufferSubData( GL_ELEMENT_ARRAY_BUFFER, (GLintptr)offset, (GLsizeiptr)size, data ); 52 52 } 53 53 … … 76 76 for ( vertex_buffer_attribute_map::iterator i = m_map.begin(); i != m_map.end(); ++i ) 77 77 { 78 int location = i->first;78 uint32 location = static_cast<uint32>( i->first ); 79 79 vertex_buffer_attribute* va = i->second; 80 80 vertex_buffer* vb = va->get_buffer(); … … 83 83 glVertexAttribPointer( 84 84 location, 85 va->get_components(),85 static_cast<GLint>( va->get_components() ), 86 86 nv::datatype_to_gl_enum( va->get_datatype() ), 87 87 GL_FALSE, 88 va->get_stride(),88 static_cast<GLsizei>( va->get_stride() ), 89 89 (void*)va->get_offset() 90 90 ); … … 107 107 for ( vertex_buffer_attribute_map::iterator i = m_map.begin(); i != m_map.end(); ++i ) 108 108 { 109 glDisableVertexAttribArray( i->first);109 glDisableVertexAttribArray( static_cast<uint32>( i->first ) ); 110 110 } 111 111 } -
trunk/src/gl/gl_window.cc
r98 r121 21 21 if (ke.keysym.unicode >= 32 && ke.keysym.unicode < 128 ) 22 22 { 23 kevent.key.ascii = (char)ke.keysym.unicode;23 kevent.key.ascii = static_cast<char8>( ke.keysym.unicode ); 24 24 } 25 25 … … 151 151 : m_device( dev ), m_width( width ), m_height( height ), m_title("NV Engine"), m_screen( nullptr ) 152 152 { 153 intflags = SDL_OPENGL;153 uint32 flags = SDL_OPENGL; 154 154 155 155 m_screen = SDL_SetVideoMode( width, height, 32, flags ); -
trunk/src/gui/gui_style.cc
r114 r121 36 36 for (size_t i = 0; i < 4; ++i ) 37 37 { 38 lua_rawgeti( m_lua, -1, i+1);38 lua_rawgeti( m_lua, -1, static_cast<int>( i+1 ) ); 39 39 if ( lua_isnil( m_lua, -1 ) ) return true; 40 40 vec[i] = (float)lua_tonumber( m_lua, -1 ); -
trunk/src/io_event.cc
r78 r121 9 9 using namespace nv; 10 10 11 const char* get_key_name( key_code key )11 const char* nv::get_key_name( key_code key ) 12 12 { 13 13 switch ( key ) … … 16 16 # include <nv/detail/key_list.inc> 17 17 # undef NV_KEY 18 default: return "KEY_UNKNOWN";18 NV_RETURN_COVERED_DEFAULT( "KEY_UNKNOWN" ); 19 19 }; 20 20 } 21 21 22 const char* get_mouse_name( mouse_code button )22 const char* nv::get_mouse_name( mouse_code button ) 23 23 { 24 24 switch ( button ) … … 27 27 # include <nv/detail/mouse_list.inc> 28 28 # undef NV_MOUSE 29 default: return "MOUSE_UNKNOWN";29 NV_RETURN_COVERED_DEFAULT( "MOUSE_UNKNOWN" ); 30 30 }; 31 31 } 32 32 33 const char* get_io_event_name( io_event_code event )33 const char* nv::get_io_event_name( io_event_code event ) 34 34 { 35 35 switch ( event ) … … 38 38 # include <nv/detail/io_event_list.inc> 39 39 # undef NV_IO_EVENT 40 default: return "EV_UNKNOWN";40 NV_RETURN_COVERED_DEFAULT( "EV_UNKNOWN" ); 41 41 }; 42 42 } 43 43 44 void register_io_types( type_database* db )44 void nv::register_io_types( type_database* db ) 45 45 { 46 46 type_enum key_enums[] = { -
trunk/src/library.cc
r120 r121 37 37 38 38 library::library() 39 : m_ name(), m_handle( nullptr)39 : m_handle( nullptr ), m_name() 40 40 { 41 41 } -
trunk/src/logger.cc
r64 r121 21 21 22 22 // log level names 23 const char *log_level_names[] =23 static const char *log_level_names[] = 24 24 { 25 25 "NONE", … … 37 37 38 38 // log level names 39 const char *log_level_names_pad[] =39 static const char *log_level_names_pad[] = 40 40 { 41 41 "NONE ", … … 57 57 58 58 #if NV_PLATFORM == NV_WINDOWS 59 unsigned short log_color[] =59 static unsigned short log_color[] = 60 60 { 61 61 FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY, … … 72 72 }; 73 73 #else 74 const char *log_color[] =74 static const char *log_color[] = 75 75 { 76 76 "\33[37;1m", -
trunk/src/lua/lua_glm.cc
r113 r121 12 12 static size_t nlua_swizzel_lookup[256]; 13 13 14 inline bool nlua_is_swizzel( const char* str, size_t max )14 inline bool nlua_is_swizzel( const unsigned char* str, size_t max ) 15 15 { 16 16 while (*str) … … 24 24 template < typename T, size_t k > 25 25 struct nlua_vec_constructor { 26 static inline T construct( lua_State* L, int index) {26 static inline T construct( lua_State*, int ) { 27 27 return T(); 28 28 } … … 202 202 size_t len = 0; 203 203 size_t vlen = v->length(); 204 const char * key = lua_tolstring( L, 2, &len);204 const unsigned char * key = (const unsigned char *)( lua_tolstring( L, 2, &len ) ); 205 205 size_t idx = 255; 206 206 … … 240 240 size_t len = 0; 241 241 size_t vlen = v->length(); 242 const char * key = lua_tolstring( L, 2, &len);242 const unsigned char * key = (const unsigned char *)( lua_tolstring( L, 2, &len ) ); 243 243 size_t idx = 255; 244 244 if( len == 1 ) … … 321 321 { 322 322 for (size_t i = 0; i < 256; ++i ) nlua_swizzel_lookup[i] = 255; 323 nlua_swizzel_lookup['x'] = 0; 324 nlua_swizzel_lookup['r'] = 0; 325 nlua_swizzel_lookup['s'] = 0; 326 nlua_swizzel_lookup['0'] = 0; 327 nlua_swizzel_lookup['y'] = 1; 328 nlua_swizzel_lookup['g'] = 1; 329 nlua_swizzel_lookup['t'] = 0; 330 nlua_swizzel_lookup['1'] = 1; 331 nlua_swizzel_lookup['z'] = 2; 332 nlua_swizzel_lookup['b'] = 2; 333 nlua_swizzel_lookup['u'] = 0; 334 nlua_swizzel_lookup['2'] = 2; 335 nlua_swizzel_lookup['w'] = 3; 336 nlua_swizzel_lookup['a'] = 3; 337 nlua_swizzel_lookup['v'] = 0; 338 nlua_swizzel_lookup['3'] = 3; 323 using nv::char8; 324 nlua_swizzel_lookup[char8( 'x' )] = 0; 325 nlua_swizzel_lookup[char8( 'r' )] = 0; 326 nlua_swizzel_lookup[char8( 's' )] = 0; 327 nlua_swizzel_lookup[char8( '0' )] = 0; 328 nlua_swizzel_lookup[char8( 'y' )] = 1; 329 nlua_swizzel_lookup[char8( 'g' )] = 1; 330 nlua_swizzel_lookup[char8( 't' )] = 0; 331 nlua_swizzel_lookup[char8( '1' )] = 1; 332 nlua_swizzel_lookup[char8( 'z' )] = 2; 333 nlua_swizzel_lookup[char8( 'b' )] = 2; 334 nlua_swizzel_lookup[char8( 'u' )] = 0; 335 nlua_swizzel_lookup[char8( '2' )] = 2; 336 nlua_swizzel_lookup[char8( 'w' )] = 3; 337 nlua_swizzel_lookup[char8( 'a' )] = 3; 338 nlua_swizzel_lookup[char8( 'v' )] = 0; 339 nlua_swizzel_lookup[char8( '3' )] = 3; 339 340 int stack = lua_gettop( L ); 340 341 341 luaL_requiref(L, "ivec2", luaopen_vec< glm::ivec2>, 1);342 luaL_requiref(L, "ivec3", luaopen_vec< glm::ivec3>, 1);343 luaL_requiref(L, "ivec4", luaopen_vec< glm::ivec4>, 1);344 luaL_requiref(L, "vec2", luaopen_vec< glm::vec2>, 1);345 luaL_requiref(L, "vec3", luaopen_vec< glm::vec3>, 1);346 luaL_requiref(L, "vec4", luaopen_vec< glm::vec4>, 1);342 luaL_requiref(L, "ivec2", luaopen_vec<nv::ivec2>, 1); 343 luaL_requiref(L, "ivec3", luaopen_vec<nv::ivec3>, 1); 344 luaL_requiref(L, "ivec4", luaopen_vec<nv::ivec4>, 1); 345 luaL_requiref(L, "vec2", luaopen_vec<nv::vec2>, 1); 346 luaL_requiref(L, "vec3", luaopen_vec<nv::vec3>, 1); 347 luaL_requiref(L, "vec4", luaopen_vec<nv::vec4>, 1); 347 348 lua_settop( L, stack ); 348 349 } -
trunk/src/lua/lua_raw.cc
r85 r121 30 30 { 31 31 index = lua_absindex( L, index ); 32 int len = lua_rawlen( L, index);32 int len = static_cast<int>( lua_rawlen( L, index ) ); 33 33 int i = len; 34 34 lua_createtable( L, len, 0 ); -
trunk/src/lua/lua_state.cc
r86 r121 15 15 using namespace nv; 16 16 17 lua::stack_guard::stack_guard( lua::state* L )18 : L( L), m_level( lua_gettop(L->L) )19 { 20 21 } 22 23 lua::stack_guard::stack_guard( lua::state& L )24 : L(& L), m_level( lua_gettop((&L)->L) )17 lua::stack_guard::stack_guard( lua::state* aL ) 18 : L(aL), m_level( lua_gettop(aL->L) ) 19 { 20 21 } 22 23 lua::stack_guard::stack_guard( lua::state& aL ) 24 : L(&aL), m_level( lua_gettop(aL.L) ) 25 25 { 26 26 -
trunk/src/time.cc
r34 r121 42 42 static timer_impl zero_timer; 43 43 44 volatilenv::uint64 nv::get_ticks()44 nv::uint64 nv::get_ticks() 45 45 { 46 46 #if NV_COMPILER == NV_MSVC 47 47 return __rdtsc(); 48 #el if NV_COMPILER == NV_GNUC49 register long long ticks asm("eax") ;48 #else 49 register long long ticks asm("eax") = 0; 50 50 asm volatile (".byte 15, 49" : : : "eax", "edx"); 51 return ticks; 52 #else 53 return 0; // unsupported 51 return static_cast<nv::uint64>( ticks ); 54 52 #endif 55 53 } … … 59 57 #if NV_COMPILER == NV_MSVC 60 58 Sleep( ms ); 61 #el if NV_COMPILER == NV_GNUC59 #else 62 60 usleep( ms * 1000 ); 63 #else64 61 #endif 65 62 } … … 85 82 struct timeval now; 86 83 gettimeofday(&now, NULL); 87 return ( now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000+(now.tv_usec-zero_timer.timeval_zero.tv_usec)/1000;84 return (uint32)( (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000+(now.tv_usec-zero_timer.timeval_zero.tv_usec)/1000 ); 88 85 #endif 89 86 } … … 99 96 struct timeval now; 100 97 gettimeofday(&now, NULL); 101 return ( now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000000+(now.tv_usec - zero_timer.timeval_zero.tv_usec);98 return (uint32)( (now.tv_sec - zero_timer.timeval_zero.tv_sec)*1000000+(now.tv_usec - zero_timer.timeval_zero.tv_usec) ); 102 99 #endif 103 100 }
Note: See TracChangeset
for help on using the changeset viewer.