Changeset 367


Ignore:
Timestamp:
05/16/15 23:12:22 (10 years ago)
Author:
epyon
Message:
  • fixed compilation and warnings on gcc
  • slowly removing/merging external includes
Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/core/array2d.hh

    r365 r367  
    320320                        if ( dest_start_x + min(size_x, source.m_size.x - source_start_x) > m_size.x || dest_start_y + min(size_y, source.m_size.y - source_start_y) > m_size.y )
    321321                        {
    322                                 NV_LOG_WARNING( "set_sub_array: Source area does not fit in the destination area.  Data will be truncated." );
     322                                //NV_LOG_WARNING( "set_sub_array: Source area does not fit in the destination area.  Data will be truncated." );
    323323                        }
    324324               
  • trunk/nv/core/math.hh

    r350 r367  
    1818#include <glm/glm.hpp>
    1919#include <glm/gtc/matrix_transform.hpp>
     20#include <glm/gtc/matrix_access.hpp>
    2021#include <glm/gtc/type_ptr.hpp>
    2122#include <glm/gtc/quaternion.hpp>
     23#include <glm/gtx/rotate_vector.hpp>
     24#include <glm/gtx/vector_angle.hpp>
    2225
    2326namespace nv
  • trunk/nv/core/string.hh

    r365 r367  
    281281        }
    282282
     283#if NV_COMPILER == NV_GNUC
     284        template< typename T >
     285        struct string_length : public detail::string_length_impl <
     286                typename std::remove_cv < typename std::remove_reference< T >::type >::type >
     287        {
     288        };
     289#else
    283290        template< typename T >
    284291        using string_length = detail::string_length_impl <
    285292                typename std::remove_cv < typename std::remove_reference< T >::type >::type >;
     293#endif
    286294
    287295        class string_ref;
     
    473481
    474482                // Non-literal constructors
    475                 template< typename U, typename std::enable_if<std::is_same<U, const char*>::value>::type* = nullptr >
    476                 inline string_ref( U str ) : string_base( str, std::strlen( str ) ) {}
     483                template< typename U >
     484                inline string_ref( U str, typename std::enable_if<std::is_same<U, const char*>::value>::type* = nullptr ) : string_base( str, std::strlen( str ) ) {}
    477485
    478486                // Non-literal constructors
    479                 template< typename U, typename std::enable_if<std::is_same<U, char*>::value>::type* = nullptr >
    480                 inline string_ref( U str ) : string_base( str, std::strlen( str ) ) {}
     487                template< typename U >
     488                inline string_ref( U str, typename std::enable_if<std::is_same<U, char*>::value>::type* = nullptr ) : string_base( str, std::strlen( str ) ) {}
    481489
    482490                inline string_ref& operator=( const string_ref &rhs )
  • trunk/nv/gfx/animation.hh

    r323 r367  
    1616#include <nv/interface/interpolation_template.hh>
    1717#include <nv/core/transform.hh>
    18 #include <glm/gtc/matrix_transform.hpp>
    1918
    2019namespace nv
  • trunk/nv/lua/lua_raw.hh

    r319 r367  
    88
    99#include <nv/core/common.hh>
     10#include <nv/core/array.hh>
    1011#include <nv/lib/lua.hh>
    11 #include <istream>
    12 #include <string>
    13 #include <vector>
    14 #include <map>
    1512
    1613void nlua_toflags_set( lua_State *L, int index, nv::uint8* data, nv::uint32 count );
  • trunk/nv/lua/lua_state.hh

    r361 r367  
    1515#include <nv/core/flags.hh>
    1616#include <nv/core/handle.hh>
    17 #include <istream>
    18 #include <map>
    1917
    2018#include <nv/lua/lua_handle.hh>
     
    193191                        explicit state( lua_State* state );
    194192                        bool do_string( string_ref code, string_ref name, int rvalues = 0 );
    195                         bool do_stream( std::istream& stream, string_ref name );
    196193                        bool do_file( string_ref filename );
    197194                        int get_stack_size();
     
    282279
    283280                        int load_string( string_ref code, string_ref name );
    284                         int load_stream( std::istream& stream, string_ref name );
    285281                        int load_file( string_ref filename );
    286282                        int do_current( string_ref name, int rvalues = 0 );
  • trunk/src/core/string.cc

    r365 r367  
    6666                n /= 10;
    6767        } while ( n > 0 );
    68         if ( n < 0 ) *s++ = '-';
    6968        *s = '\0';
    7069        string_reverse( str, s - 1 );
     
    8079                n /= 10;
    8180        } while ( n > 0 );
    82         if ( n < 0 ) *s++ = '-';
    8381        *s = '\0';
    8482        string_reverse( str, s - 1 );
     
    9189        sprintf_s( str, 64, "%.*g", 6, n );
    9290#else
    93         snprintf( buffer, 64, "%.*g", 6, n );
     91        snprintf( str, 64, "%.*g", 6, n );
    9492#endif
    9593        sprintf( str, "%g", n );
     
    102100        sprintf_s( str, 64, "%.*g", 6, n );
    103101#else
    104         snprintf( buffer, 64, "%.*g", 6, n );
     102        snprintf( str, 64, "%.*g", 6, n );
    105103#endif
    106104        return strlen( str );
  • trunk/src/formats/assimp_loader.cc

    r365 r367  
    77#include "nv/formats/assimp_loader.hh"
    88#include <unordered_map>
    9 #include <glm/gtx/transform.hpp>
    109#include "nv/io/std_stream.hh"
    1110#include "nv/gfx/mesh_creator.hh"
  • trunk/src/formats/md2_loader.cc

    r365 r367  
    77#include "nv/formats/md2_loader.hh"
    88
    9 #include <glm/gtc/constants.hpp>
    109#include "nv/core/logging.hh"
    1110#include <cstring>
  • trunk/src/formats/md3_loader.cc

    r352 r367  
    77#include "nv/formats/md3_loader.hh"
    88
    9 #include <glm/gtc/constants.hpp>
    109#include "nv/core/logging.hh"
    1110#include <cstring>
  • trunk/src/formats/md5_loader.cc

    r323 r367  
    55#include "nv/formats/md5_loader.hh"
    66
    7 #include <glm/gtc/constants.hpp>
    87#include "nv/core/logging.hh"
    98#include "nv/io/std_stream.hh"
    10 #include <cstring>
    119
    1210using namespace nv;
     
    1412static void next_line( std::istream& stream )
    1513{
    16         stream.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
     14        stream.ignore( 1024*1024, '\n' );
    1715}
    1816
    1917static inline void discard( std::istream& stream, const std::string& token )
    2018{
    21 //      stream.ignore( std::numeric_limits<std::streamsize>::max(), ' ' );
    2219        std::string discarded;
    2320        stream >> discarded;
  • trunk/src/gfx/keyframed_mesh.cc

    r319 r367  
    55#include "nv/gfx/keyframed_mesh.hh"
    66
    7 #include <glm/gtc/matrix_access.hpp>
    8 #include <glm/gtx/matrix_interpolation.hpp>
    97#include "nv/interface/context.hh"
    108#include "nv/interface/device.hh"
    11 
    12 
    139#include "nv/core/logging.hh"
    1410
  • trunk/src/gfx/skeletal_mesh.cc

    r323 r367  
    55#include "nv/gfx/skeletal_mesh.hh"
    66
    7 #include <glm/gtc/matrix_access.hpp>
    8 #include <glm/gtx/matrix_interpolation.hpp>
    97#include "nv/interface/context.hh"
    108#include "nv/interface/device.hh"
    11 
    129
    1310nv::skeletal_mesh_cpu::skeletal_mesh_cpu( context* a_context, const mesh_data* a_mesh_data, const mesh_nodes_data* bones )
  • trunk/src/gfx/texture_atlas.cc

    r319 r367  
    88
    99#include "nv/core/logging.hh"
    10 #include <iostream>
    1110
    1211using namespace nv;
  • trunk/src/gfx/texture_font.cc

    r365 r367  
    66#include "nv/gfx/texture_font.hh"
    77
    8 #include <sstream>
    9 #include <stdexcept>
    108#include "nv/lib/freetype2.hh"
    119#include "nv/core/logging.hh"
     
    126124                if ( error )
    127125                {
    128                         std::stringstream error_msg;
    129                         error_msg << "FT_Error while loading glyphs, error: "
    130                                 << error << " code: " << c;
    131                         NV_THROW( std::runtime_error, error_msg.str().c_str() );
     126                        NV_LOG_ERROR( "FT_Error while loading glyphs, error: ", error, " code: ", c );
     127                        NV_THROW( std::runtime_error, "FT_Error while loading glyphs" );
    132128                }
    133129
     
    144140                if ( r.pos.x < 0 )
    145141                {
    146                         std::stringstream error_msg;
    147                         error_msg << "Atlas full while loading glyphs, "
    148                                 << "r.pos.x: " << r.pos.x << " code: "
    149                                 << c;
    150                         NV_THROW( std::runtime_error, error_msg.str().c_str() );
     142                        NV_LOG_ERROR( "Atlas full while loading glyphs, r.pos.x: ", r.pos.x, " code: ", c );
     143                        NV_THROW( std::runtime_error, "Atlas full while loading glyphs" );
    151144                }
    152145                if (depth == 4)
  • trunk/src/gui/gui_gfx_renderer.cc

    r365 r367  
    66
    77#include "nv/gui/gui_gfx_renderer.hh"
    8 
    9 #include <glm/gtc/matrix_transform.hpp>
    108
    119#include "nv/interface/device.hh"
  • trunk/src/lua/lua_aux.cc

    r319 r367  
    77#include "nv/lua/lua_aux.hh"
    88
    9 #include <utility>
    109#include "nv/lua/lua_raw.hh"
    1110#include "nv/core/random.hh"
     
    117116                        int arg1 = static_cast< int >( luaL_checkinteger( L, 1 ) );
    118117                        int arg2 = static_cast< int >( luaL_checkinteger( L, 2 ) );
    119                         if (arg2 < arg1) std::swap( arg2, arg1 );
    120                         lua_pushinteger( L, nv::random::get().srange( arg1, arg2 ) );
     118                        int result = ( arg2 >= arg1 ? nv::random::get().srange( arg1, arg2 ) : nv::random::get().srange( arg2, arg1 ) );
     119                        lua_pushinteger( L, result );
    121120                }
    122121        }
  • trunk/src/lua/lua_state.cc

    r365 r367  
    356356}
    357357
    358 int lua::state::load_stream( std::istream& stream, string_ref name )
    359 {
    360         NV_LOG_NOTICE( "Loading Lua stream '", name, "'");
    361         return load_string( std::string(
    362                 (std::istreambuf_iterator<char>(stream)),
    363                 std::istreambuf_iterator<char>()), name );
    364 }
    365 
    366358int lua::state::load_file( string_ref filename )
    367359{
     
    380372        }
    381373        return do_current( name, rvalues ) == 0;
    382 }
    383 
    384 bool lua::state::do_stream( std::istream& stream, string_ref name )
    385 {
    386         lua::stack_guard( this );
    387         int result = load_stream(stream,name);
    388         if (result)
    389         {
    390                 NV_LOG_WARNING( "Failed to open stream ", name, ": ", lua_tostring( m_state, -1 ) );
    391                 return false;
    392         }
    393         return do_current( name ) == 0;
    394374}
    395375
  • trunk/src/sdl/sdl_audio.cc

    r365 r367  
    77#include "nv/sdl/sdl_audio.hh"
    88
    9 #include <glm/gtx/vector_angle.hpp>
    10 #include "nv/lib/sdl.hh"
     9#include "nv/core/math.hh"
    1110#include "nv/lib/sdl_mixer.hh"
    1211#include "nv/core/logging.hh"
  • trunk/src/sdl/sdl_window.cc

    r365 r367  
    99#include "nv/lib/sdl.hh"
    1010#include "nv/sdl/sdl_input.hh"
     11#include "nv/gl/gl_context.hh"
    1112
    1213using namespace nv;
Note: See TracChangeset for help on using the changeset viewer.