Changeset 374 for trunk/src


Ignore:
Timestamp:
05/26/15 17:35:06 (10 years ago)
Author:
epyon
Message:
  • MASSIVE commit
  • common.hh - size_t, ptrdiff_t, nv:: namespace, NV_ALIGN_OF and basic template tools
  • STL - algorithm.hh, iterator.hh, limits.hh, numeric.hh and type_info.hh
  • STL - updates to memory, array and string
Location:
trunk/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/curses/curses_terminal.cc

    r369 r374  
    6565        }
    6666        mvaddch( p.y-1, p.x-1, ch );
    67         move( m_cursor.y-1, m_cursor.x-1 );
     67        ::move( m_cursor.y-1, m_cursor.x-1 );
    6868}
    6969
     
    8080        m_update_needed = true;
    8181        ::clear();
    82         move( m_cursor.y-1, m_cursor.x-1 );
     82        ::move( m_cursor.y-1, m_cursor.x-1 );
    8383}
    8484
     
    160160{
    161161        terminal::set_cursor( p );
    162         move( m_cursor.y-1, m_cursor.x-1 );
     162        ::move( m_cursor.y-1, m_cursor.x-1 );
    163163}
    164164
  • trunk/src/engine/particle_engine.cc

    r365 r374  
    77#include <nv/interface/device.hh>
    88#include <nv/core/random.hh>
     9#include <nv/stl/utility.hh>
    910#include <nv/lua/lua_glm.hh>
    1011#include <nv/core/logging.hh>
    11 #include <cmath>
    1212
    1313static const char *nv_particle_engine_vertex_shader_world =
     
    203203        if ( datap->average )
    204204        {
    205                 float norm_factor = glm::min( factor, 1.0f );
     205                float norm_factor = nv::min( factor, 1.0f );
    206206                for ( uint32 i = 0; i < count; ++i )
    207207                        p[i].velocity = datap->force_vector * norm_factor + p[i].velocity * ( 1.0f - norm_factor );
     
    696696                        {
    697697                                info->count--;
    698                                 std::swap( info->particles[i], info->particles[info->count] );
     698                                swap( info->particles[i], info->particles[info->count] );
    699699                        }
    700700                }
  • trunk/src/formats/md2_loader.cc

    r367 r374  
    238238}
    239239
    240 size_t md2_loader::get_max_frames() const
     240nv::size_t md2_loader::get_max_frames() const
    241241{
    242242        return static_cast< size_t >( ((md2_t*)m_md2)->header.num_frames );
  • trunk/src/formats/md3_loader.cc

    r367 r374  
    172172        source.read( surface->vertices, sizeof( md3_vertex_t ), static_cast<size_t>( surface->header.num_verts * surface->header.num_frames ) );
    173173
    174         if ( source.tell() != static_cast<std::size_t>( pos + surface->header.ofs_end ) ) return false;
     174        if ( source.tell() != static_cast<size_t>( pos + surface->header.ofs_end ) ) return false;
    175175
    176176        return true;
  • trunk/src/formats/md5_loader.cc

    r367 r374  
    344344                vtc.tangent  = glm::vec3(0);
    345345
    346                 std::sort( weights + start_weight, weights + start_weight + weight_count, [](const md5_weight& a, const md5_weight& b) -> bool { return a.bias > b.bias; } );
     346                stable_sort( weights + start_weight, weights + start_weight + weight_count, [] ( const md5_weight& a, const md5_weight& b ) -> bool { return a.bias > b.bias; } );
     347                //std::sort( weights + start_weight, weights + start_weight + weight_count, [](const md5_weight& a, const md5_weight& b) -> bool { return a.bias > b.bias; } );
    347348
    348349                if ( weight_count > 4 )
  • trunk/src/formats/obj_loader.cc

    r319 r374  
    5353        std::string next_name;
    5454
    55         std::size_t size;
    56         bool        eof;
     55        size_t size;
     56        bool   eof;
    5757
    5858        obj_reader();
     
    172172{
    173173        mesh_data_reader( bool normals ) : m_normals( normals ) {}
    174         virtual std::size_t add_face( uint32* vi, uint32* ti, uint32* ni, size_t count )
     174        virtual size_t add_face( uint32* vi, uint32* ti, uint32* ni, size_t count )
    175175        {
    176176                if ( count < 3 ) return 0; // TODO : report error?
     
    178178                // TODO : support if normals not present;
    179179                vec3 nullvec;
    180                 std::size_t result = 0;
     180                size_t result = 0;
    181181                // Simple triangulation - obj's shouldn't have more than quads anyway
    182182
     
    278278                }
    279279
    280                 for (std::size_t a = 0; a < count; ++a )
     280                for (size_t a = 0; a < count; ++a )
    281281                {
    282282                        const vec3& n = m_data[a].normal;
  • trunk/src/gfx/image.cc

    r323 r374  
    44
    55#include "nv/gfx/image.hh"
    6 
    7 #include <algorithm>
    86
    97using namespace nv;
  • trunk/src/io/c_stream.cc

    r319 r374  
    66#include <sys/stat.h>
    77#include "nv/io/c_stream.hh"
    8 #include <limits>
    98
    109using namespace nv;
  • trunk/src/io/std_stream.cc

    r319 r374  
    88
    99#include "nv/io/std_stream.hh"
    10 #include <algorithm>
     10#include "nv/stl/math.hh"
     11#include "nv/stl/utility.hh"
    1112
    1213using namespace nv;
     
    1516        : m_stream( source )
    1617        , m_owner( owner )
    17         , m_buffer( std::max(bsize, put_back) + put_back )
    18         , m_put_back( std::max( put_back, std::size_t( 1 ) ) )
     18        , m_buffer( nv::max(bsize, put_back) + put_back )
     19        , m_put_back( nv::max( put_back, std::size_t( 1 ) ) )
    1920{
    2021        char *end = &m_buffer.front() + m_buffer.size();
  • trunk/src/lib/curses.cc

    r319 r374  
    1111#include "nv/core/library.hh"
    1212
     13#define FILE void
    1314#define NV_CURSES_FUN( rtype, fname, fparams ) rtype (*fname) fparams = nullptr;
    1415#include <nv/lib/detail/curses_functions.inc>
     
    2122        curses_library.open( path );
    2223
    23 #       define NV_CURSES_FUN( rtype, fname, fparams ) *(void **) (&fname) = curses_library.get(#fname);
     24#       define NV_CURSES_FUN( rtype, fname, fparams ) *(void **) (&::fname) = curses_library.get(#fname);
    2425#       include <nv/lib/detail/curses_functions.inc>
    2526#       undef NV_CURSES_FUN
  • trunk/src/lua/lua_area.cc

    r368 r374  
    7979{
    8080        nv::rectangle* a = to_parea( L, 1 );
    81         std::size_t l;
     81        nv::size_t l;
    8282        const char* index = lua_tolstring( L, 2, &l );
    8383        if ( l == 1 && index[0] == 'a' )
     
    101101{
    102102        nv::rectangle* a = to_parea( L, 1 );
    103         std::size_t l;
     103        nv::size_t l;
    104104        const char* index = lua_tolstring( L, 2, &l );
    105105        nv::ivec2 value( to_coord( L, 3 ) );
  • trunk/src/lua/lua_map_tile.cc

    r369 r374  
    77#include "nv/lua/lua_map_tile.hh"
    88
    9 #include <numeric>
    109#include "nv/lua/lua_map_area.hh"
    1110#include "nv/stl/flags.hh"
     11#include "nv/stl/numeric.hh"
     12#include "nv/stl/algorithm.hh"
    1213#include "nv/core/random.hh"
    1314#include "nv/lua/lua_area.hh"
     
    5960        map_tile tile;
    6061
    61         tile.size_y = (nv::uint16)( std::count( code.begin(), code.end(), '\n' ) + 1 );
     62        tile.size_y = (nv::uint16)( nv::count( code.begin(), code.end(), '\n' ) + 1 );
    6263        tile.size_x = (nv::uint16)( code.find( '\n' ) );
    6364        if ( tile.size_x == 0 )
     
    236237        nv::uint16 org_x = tile->size_x;
    237238        nv::uint16 org_y = tile->size_y;
    238         nv::uint16 new_x = (nv::uint16)std::accumulate( sizes_x.begin(), sizes_x.end(), 0 );
    239         nv::uint16 new_y = (nv::uint16)std::accumulate( sizes_y.begin(), sizes_y.end(), 0 );
     239        nv::uint16 new_x = ( nv::uint16 )nv::accumulate( sizes_x.begin(), sizes_x.end(), 0 );
     240        nv::uint16 new_y = ( nv::uint16 )nv::accumulate( sizes_y.begin(), sizes_y.end(), 0 );
    240241
    241242        nv::uint8* data = new nv::uint8[ new_x * new_y ];
  • trunk/src/stl/string.cc

    r368 r374  
    2828}
    2929
    30 size_t nv::sint32_to_buffer( sint32 n, char* str )
     30nv::size_t nv::sint32_to_buffer( sint32 n, char* str )
    3131{
    3232        char* s = str;
     
    4343}
    4444
    45 size_t nv::sint64_to_buffer( sint64 n, char* str )
     45nv::size_t nv::sint64_to_buffer( sint64 n, char* str )
    4646{
    4747        char* s = str;
     
    5858}
    5959
    60 size_t nv::uint32_to_buffer( uint32 n, char* str )
     60nv::size_t nv::uint32_to_buffer( uint32 n, char* str )
    6161{
    6262        char* s = str;
     
    7171}
    7272
    73 size_t nv::uint64_to_buffer( uint64 n, char* str )
     73nv::size_t nv::uint64_to_buffer( uint64 n, char* str )
    7474{
    7575        char* s = str;
     
    8484}
    8585
    86 size_t nv::f32_to_buffer( f32 n, char* str )
     86nv::size_t nv::f32_to_buffer( f32 n, char* str )
    8787{
    8888#if NV_COMPILER == NV_MSVC
     
    9595}
    9696
    97 size_t nv::f64_to_buffer( f64 n, char* str )
     97nv::size_t nv::f64_to_buffer( f64 n, char* str )
    9898{
    9999#if NV_COMPILER == NV_MSVC
Note: See TracChangeset for help on using the changeset viewer.