Changeset 441


Ignore:
Timestamp:
07/24/15 11:13:32 (10 years ago)
Author:
epyon
Message:
  • md5 support moved to legacy code
  • more std::string removal
  • minor fixes in algorithm
Location:
trunk
Files:
7 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/nv/base/capi.hh

    r436 r441  
    102102        inline void* nvmemcpy( void *dest, const void *src, size_t count )
    103103        {
     104                if ( dest == src ) return dest;
    104105                return NV_CAPI_CALL( memcpy )( dest, src, count );
    105106        }
     
    107108        inline void* nvmemmove( void *dest, const void *src, size_t count )
    108109        {
     110                if ( dest == src ) return dest;
    109111                return NV_CAPI_CALL( memmove )( dest, src, count );
    110112        }
  • trunk/nv/gfx/skeletal_mesh.hh

    r431 r441  
    1111#include <nv/interface/context.hh>
    1212#include <nv/interface/animated_mesh.hh>
    13 #include <nv/formats/md5_loader.hh>
    1413#include <nv/formats/nmd_loader.hh>
     14#include <nv/stl/array.hh>
    1515
    1616namespace nv
    1717{
     18       
     19        // TODO: remove or make generic
     20        struct md5_vtx_pnt
     21        {
     22                vec3 position;
     23                vec3 normal;
     24                vec3 tangent;
     25        };
     26
     27        // TODO: remove or make generic
     28        struct md5_key_t
     29        {
     30                transform tform;
     31        };
     32
     33        // TODO: remove or make generic
     34        struct md5_vtx_t
     35        {
     36                vec2 texcoord;
     37        };
     38
     39        // TODO: remove or make generic
     40        struct md5_vtx_pntiw
     41        {
     42                vec3  position;
     43                vec3  normal;
     44                vec3  tangent;
     45                ivec4 boneindex;
     46                vec4  boneweight;
     47        };
     48
     49
    1850        class skeletal_mesh : public animated_mesh
    1951        {
  • trunk/nv/lua/lua_raw.hh

    r437 r441  
    2929}
    3030
    31 // TODO: this is not thread safe!
    32 nv::string_view nlua_typecontent( lua_State* L, int idx );
     31nv::string64 nlua_typecontent( lua_State* L, int idx );
    3332void nlua_shallowmerge( lua_State *L, int index );
    3433void nlua_shallowcopy( lua_State *L, int index );
  • trunk/nv/stl/algorithm/raw.hh

    r403 r441  
    3434        T* raw_copy( const T* first, const T* last, T* out )
    3535        {
    36                 NV_ASSERT_DEBUG( last - first > 0, "raw_copy range fail!" );
     36                NV_ASSERT_DEBUG( last - first >= 0, "raw_copy range fail!" );
    3737                return static_cast<T*>( nvmemcpy( out, first, detail::byte_distance( first, last ) ) ) + ( last - first );
    3838        }
     
    4747        T* raw_alias_copy( const T* first, const T* last, T* out )
    4848        {
    49                 NV_ASSERT_DEBUG( last - first > 0, "raw_alias_copy range fail!" );
     49                NV_ASSERT_DEBUG( last - first >= 0, "raw_alias_copy range fail!" );
    5050                return static_cast<T*>( nvmemmove( out, first, detail::byte_distance( first, last ) ) ) + ( last - first );
    5151        }
     
    6060        T* raw_zero( T* first, T* last )
    6161        {
    62                 NV_ASSERT_DEBUG( last - first > 0, "raw_zero range fail!" );
     62                NV_ASSERT_DEBUG( last - first >= 0, "raw_zero range fail!" );
    6363                return static_cast<T*>( nvmemset( first, 0, detail::byte_distance( first, last ) ) ) + ( last - first );
    6464        }
     
    7373        T* raw_fill( T* first, T* last, unsigned char value )
    7474        {
    75                 NV_ASSERT_DEBUG( last - first > 0, "raw_fill range fail!" );
     75                NV_ASSERT_DEBUG( last - first >= 0, "raw_fill range fail!" );
    7676                return static_cast<T*>( nvmemset( first, value, detail::byte_distance( first, last ) ) ) + ( last - first );
    7777        }
  • trunk/nv/stl/string/short_string.hh

    r440 r441  
    145145                }
    146146
     147                iterator erase( iterator position )
     148                {
     149                        iterator result = Storage::erase( position );
     150                        this->data()[this->size()] = 0;
     151                        return result;
     152                }
     153
     154                iterator erase( iterator first, iterator last )
     155                {
     156                        iterator result = Storage::erase( first, last );
     157                        this->data()[this->size()] = 0;
     158                        return result;
     159                }
     160
    147161        protected:
    148162
     
    163177                using Storage::assign;
    164178                using Storage::insert;
    165                 using Storage::erase;
    166179                using Storage::pop_back;
    167180                using Storage::push_back;
  • trunk/src/lua/lua_map_tile.cc

    r440 r441  
    1717#include "nv/lua/lua_raw.hh"
    1818
    19 // TODO: REMOVE
    20 #include <string>
    21 
    2219static const char* NLUA_MAP_TILE_METATABLE = "map_tile";
    2320
     
    5855        nv::map_area* map_area = nv::lua::detail::to_map_area( L, 3 );
    5956        lua_settop( L, 2 );
    60         nv::string_view lts = nv::trimmed( lua_tostring( L, 1 ) );
    61         std::string code( lts.data(), lts.size() );
    62         std::string chars( " \r\t" );
     57        nv::string_buffer code( nv::trimmed( lua_tostring( L, 1 ) ) );
     58        nv::string_view chars( " \r\t" );
    6359        code.erase( nv::remove_if( code.begin(), code.end(),
    6460                [&chars] ( const char& c )
    6561        {
    66                 return chars.find( c ) != std::string::npos;
     62                return chars.find( c ) != nv::string_view::npos;
    6763        } ), code.end() );
    6864
  • trunk/src/lua/lua_raw.cc

    r438 r441  
    77#include "nv/lua/lua_raw.hh"
    88
    9 nv::string_view nlua_typecontent( lua_State* L, int idx )
     9nv::string64 nlua_typecontent( lua_State* L, int idx )
    1010{
    1111        int type = lua_type( L, idx );
    1212        switch ( type )
    1313        {
    14         case LUA_TNONE          : return "NONE";
    15         case LUA_TNIL               : return "NIL";
    16         case LUA_TBOOLEAN               : return lua_toboolean( L, idx ) == 0 ? "false" : "true";
    17         //case LUA_TLIGHTUSERDATA       : return std::to_string( nv::uint64( lua_touserdata( L, idx ) ) );
    18         //case LUA_TNUMBER              : return std::to_string( lua_tonumber( L, idx ) );
    19         // TODO: copy to buffer?
    20         case LUA_TSTRING                : return nlua_tostringview( L, idx );
    21         case LUA_TTABLE             : return "TABLE";
    22         case LUA_TFUNCTION              : return "FUNCTION";
    23 //      case LUA_TUSERDATA              : return std::to_string( nv::uint64( lua_touserdata( L, idx ) ) );
    24         case LUA_TTHREAD                : return "THREAD";
     14        case LUA_TNONE          : return nv::string64( "NONE" );
     15        case LUA_TNIL               : return nv::string64( "NIL" );
     16        case LUA_TBOOLEAN               : return nv::string64( lua_toboolean( L, idx ) == 0 ? "false" : "true" );
     17        case LUA_TSTRING                : return nv::string64( nlua_tostringview( L, idx ) );
     18        case LUA_TTABLE             : return nv::string64( "TABLE" );
     19        case LUA_TFUNCTION              : return nv::string64( "FUNCTION" );
     20        case LUA_TTHREAD                : return nv::string64( "THREAD" );
    2521        default : break;
    2622        }
    27         static char buffer_data[64];
    28         nv::array_ref< char > buffer( buffer_data, 64 );
    2923        if ( type == LUA_TLIGHTUSERDATA || type == LUA_TUSERDATA )
    3024        {
     25                nv::string64 buffer;
    3126                size_t l = nv::uint64_to_buffer( buffer, nv::uint64( lua_touserdata( L, idx ) ) );
    32                 return nv::string_view( buffer.data(), l );
     27                return buffer;
    3328        }
    3429        else if ( type == LUA_TNUMBER )
    3530        {
     31                nv::string64 buffer;
    3632                size_t l = nv::f64_to_buffer( buffer, lua_tonumber( L, idx ) );
    37                 return nv::string_view( buffer.data(), l );
    38         }
    39         return "UNKNOWN!";
     33                return buffer;
     34        }
     35        return nv::string64( "UNKNOWN!" );
    4036}
    4137
Note: See TracChangeset for help on using the changeset viewer.