Changeset 392


Ignore:
Timestamp:
06/11/15 16:23:41 (10 years ago)
Author:
epyon
Message:
  • massive shift towards nova STL
  • include cleanups


Location:
trunk
Files:
38 edited

Legend:

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

    r383 r392  
    1717#include <nv/stl/singleton.hh>
    1818#include <nv/stl/string.hh>
    19 #include <unordered_map>
     19#include <nv/stl/unordered_map.hh>
    2020
    2121#if NV_PROFILER
     
    5050                        ~node();
    5151                protected:
    52                         typedef std::unordered_map< std::string, node* > map;
     52                        typedef unordered_map< std::string, node* > map;
    5353
    5454                        std::string m_tag;
  • trunk/nv/core/types.hh

    r385 r392  
    99#include <nv/stl/math.hh>
    1010#include <nv/stl/memory.hh>
     11#include <nv/stl/vector.hh>
     12#include <nv/stl/unordered_map.hh>
    1113#include <nv/stl/cstring_store.hh>
    1214#include <nv/stl/type_traits/properties.hh>
    13 #include <unordered_map>
    14 #include <vector>
    1515
    1616namespace nv
     
    7878                size_t                  size;        //!< Result of sizeof(type) operation
    7979                type_entry*             base_type;   //!< Base type
    80                 std::vector<type_field> field_list;  //!< Field list
    81                 std::vector<type_enum>  enum_list;   //!< Enum list
     80                vector<type_field> field_list;  //!< Field list
     81                vector<type_enum>  enum_list;   //!< Enum list
    8282                cstring_store names;
    8383        };
     
    154154                }
    155155        private:
    156                 typedef std::vector<type_entry*>                   type_list;
    157                 typedef std::unordered_map<type_hash, type_entry*> type_info_map;
     156                typedef vector<type_entry*>                   type_list;
     157                typedef unordered_map<type_hash, type_entry*> type_info_map;
    158158                cstring_store m_names;
    159159                type_list     m_type_list;
  • trunk/nv/core/uid.hh

    r379 r392  
    1515
    1616#include <nv/core/common.hh>
    17 #include <unordered_map>
     17#include <nv/stl/unordered_map.hh>
    1818
    1919namespace nv
     
    7474
    7575        protected:
    76                 typedef std::unordered_map< uid, void* > map;
     76                typedef unordered_map< uid, void* > map;
    7777                map m_map; ///< The hash map everything is stored in.
    7878                uid m_current; ///< The last UID assigned.
  • trunk/nv/engine/particle_engine.hh

    r368 r392  
    1010#include <nv/core/common.hh>
    1111#include <nv/stl/math.hh>
    12 #include <nv/stl/array.hh>
     12#include <nv/stl/vector.hh>
     13#include <nv/stl/unordered_map.hh>
    1314#include <nv/stl/handle.hh>
    1415#include <nv/lua/lua_state.hh>
     
    194195
    195196                handle_store< particle_system_info, particle_system >      m_systems;
    196                 std::unordered_map< std::string, uint32 >                  m_names;
    197                 std::vector< particle_system_data >                        m_data;
    198                 std::unordered_map< std::string, particle_emmiter_func >   m_emmiters;
    199                 std::unordered_map< std::string, particle_affector_funcs > m_affectors;
     197                unordered_map< std::string, uint32 >                  m_names;
     198                vector< particle_system_data >                        m_data;
     199                unordered_map< std::string, particle_emmiter_func >   m_emmiters;
     200                unordered_map< std::string, particle_affector_funcs > m_affectors;
    200201        };
    201202
  • trunk/nv/fmod/fmod_audio.hh

    r347 r392  
    3434                        virtual channel play_sound( sound a_sound, float volume = 1.0f, float pan = 0.0f );
    3535                        virtual channel play_sound( sound a_sound, vec3 position );
    36                         virtual sound load_sound( const std::string& a_path );
     36                        virtual sound load_sound( const string_ref& a_path );
    3737                        virtual void release( sound a_sound );
    3838                        virtual void set_orientation( vec3 forward, vec3 up );
  • trunk/nv/formats/md2_loader.hh

    r383 r392  
    1515
    1616#include <nv/core/common.hh>
    17 #include <nv/stl/array.hh>
     17#include <nv/stl/vector.hh>
    1818#include <nv/interface/mesh_loader.hh>
    1919
  • trunk/nv/formats/md3_loader.hh

    r383 r392  
    1515
    1616#include <nv/core/common.hh>
    17 #include <unordered_map>
    18 #include <nv/stl/array.hh>
    1917#include <nv/core/transform.hh>
    2018#include <nv/interface/mesh_data.hh>
  • trunk/nv/formats/nmd_loader.hh

    r319 r392  
    1111#include <nv/interface/mesh_loader.hh>
    1212#include <nv/interface/mesh_data.hh>
     13#include <nv/stl/vector.hh>
    1314#include <nv/io/string_table.hh>
    1415
     
    8687                mesh_node_data*           m_node_array;
    8788                string_table*             m_strings;
    88                 std::vector< uint16 >     m_mesh_names;
    89                 std::vector< uint16 >     m_node_names;
    90                 std::vector< mesh_data* > m_meshes;
     89                vector< uint16 >          m_mesh_names;
     90                vector< uint16 >          m_node_names;
     91                vector< mesh_data* >      m_meshes;
    9192        };
    9293
  • trunk/nv/formats/obj_loader.hh

    r383 r392  
    1717#include <nv/interface/mesh_loader.hh>
    1818#include <nv/interface/mesh_data.hh>
     19#include <nv/stl/vector.hh>
    1920
    2021namespace nv
  • trunk/nv/gfx/animation.hh

    r368 r392  
    99
    1010#include <nv/core/common.hh>
    11 #include <nv/stl/array.hh>
     11#include <nv/stl/vector.hh>
    1212#include <nv/interface/stream.hh>
    1313#include <nv/stl/math.hh>
     
    198198        private:
    199199                key_descriptor m_final_key;
    200                 std::vector< key_raw_channel* > m_channels;
     200                vector< key_raw_channel* > m_channels;
    201201        };
    202202
  • trunk/nv/gfx/debug_draw.hh

    r368 r392  
    1010#include <nv/core/common.hh>
    1111#include <nv/stl/math.hh>
     12#include <nv/stl/vector.hh>
    1213#include <nv/interface/context.hh>
    1314
     
    3738                ~debug_data();
    3839        private:
    39                 context*                 m_context;
    40                 program                  m_program;
    41                 vertex_array             m_va;
    42                 std::vector< debug_vtx > m_data;
     40                context*            m_context;
     41                program             m_program;
     42                vertex_array        m_va;
     43                vector< debug_vtx > m_data;
    4344        };
    4445
  • trunk/nv/gfx/skeletal_mesh.hh

    r323 r392  
    9090        protected:
    9191                const mesh_nodes_data* m_node_data;
    92                 std::vector< uint32 >* m_children;
     92                vector< uint32 >* m_children;
    9393                sint16* m_bone_ids;
    9494                mat4* m_offsets;
  • trunk/nv/gfx/sliced_buffer.hh

    r368 r392  
    1313#include <nv/core/common.hh>
    1414#include <nv/stl/math.hh>
     15#include <vector> // TODO: remove
    1516
    1617namespace nv
     
    2324        {
    2425        public:
    25                 typedef sliced_buffer<T> cache;
    26                 typedef std::vector<T>  vector;
    27 
    28                 buffer_slice( cache* c )
     26                typedef sliced_buffer<T> cache_type;
     27                typedef std::vector<T>   vector_type;
     28                typedef size_t           size_type;
     29
     30                buffer_slice( cache_type* c )
    2931                        : m_cache( c ), m_offset( 0 ), m_cached_size( 0 ), m_locked( true )
    3032                {
     
    6365                }
    6466
    65                 vector& lock()
     67                vector_type& lock()
    6668                {
    6769                        m_locked = true;
    6870                        return m_data;
    6971                }
    70                 const vector& data()
     72                const vector_type& data()
    7173                {
    7274                        return m_data;
     
    7779                }
    7880        public:
    79                 vector m_data;
    80                 cache* m_cache;
    81                 size_t m_offset;
    82                 size_t m_cached_size;
    83                 bool   m_locked;
     81                vector_type m_data;
     82                cache_type* m_cache;
     83                size_type  m_offset;
     84                size_type  m_cached_size;
     85                bool        m_locked;
    8486        };
    8587
     
    8890        {
    8991        public:
    90                 typedef std::vector<T>  vector;
     92                typedef std::vector<T>  vector_type;
    9193                typedef T               value_type;
    9294                static const size_t value_type_size = sizeof(T);
     
    106108                }
    107109
    108                 bool commit( const vector& bv, bool updated, bool resized, size_t& offset )
     110                bool commit( const vector_type& bv, bool updated, bool resized, size_t& offset )
    109111                {
    110112                        if ( !m_full_update && resized )
     
    121123                        else if ( updated )
    122124                        {
    123                                 std::copy( bv.cbegin(), bv.cend(), m_data.begin() + (int)offset );
     125//                              raw_copy( bv.cbegin(), bv.cend(), m_data.begin() + (int)offset );
     126                                raw_copy( bv.data(), bv.data() + bv.size(), m_data.data() + (int)offset );
    124127                                m_min = nv::min<size_t>( m_min, offset );
    125128                                m_max = nv::max<size_t>( m_max, offset + bv.size() );
     
    208211                buffer_hint m_hint;
    209212                bool        m_full_update;
    210                 vector      m_data;
     213                vector_type m_data;
    211214                uint32      m_capacity;
    212215
     
    224227                typedef buffer_slice<T> vertex_slice;
    225228                typedef buffer_slice<I> index_slice;
    226                 typedef typename vertex_slice::vector vertex_vector;
    227                 typedef typename index_slice::vector  index_vector;
     229                typedef typename vertex_slice::vector_type vertex_vector;
     230                typedef typename index_slice::vector_type  index_vector;
    228231
    229232                indexed_buffer_slice( cache* c )
  • trunk/nv/gui/gui_environment.hh

    r379 r392  
    1919#include <nv/core/io_event.hh>
    2020#include <nv/interface/window.hh>
    21 #include <nv/stl/array.hh>
    2221
    2322namespace nv
  • trunk/nv/interface/audio.hh

    r368 r392  
    1414
    1515#include <nv/core/common.hh>
     16#include <nv/stl/string.hh>
    1617#include <nv/stl/math.hh>
    1718#include <nv/stl/handle.hh>
     
    3132                virtual channel play_sound( sound a_sound, vec3 position ) = 0;
    3233                // temporary - use streams later
    33                 virtual sound load_sound( const std::string& a_path ) = 0;
     34                virtual sound load_sound( const string_ref& a_path ) = 0;
    3435                virtual void release( sound a_sound ) = 0;
    3536                virtual void set_orientation( vec3 forward, vec3 up ) = 0;
  • trunk/nv/interface/context.hh

    r383 r392  
    124124
    125125                template < typename VTX, slot SLOT >
    126                 void add_vertex_buffer_impl( vertex_array, buffer, const std::false_type& )
     126                void add_vertex_buffer_impl( vertex_array, buffer, const false_type& )
    127127                {
    128128                }
    129129
    130130                template < typename VTX, slot SLOT >
    131                 void add_vertex_buffer_impl( vertex_array va, buffer vb, const std::true_type& )
     131                void add_vertex_buffer_impl( vertex_array va, buffer vb, const true_type& )
    132132                {
    133133                        typedef vertex_slot_info< VTX, SLOT > vinfo;
     
    139139                void add_vertex_buffer( vertex_array va, buffer vb )
    140140                {
    141                         add_vertex_buffer_impl< VTX, SLOT >( va, vb, std::integral_constant< bool, vertex_has_slot< VTX, SLOT >::value >() );
     141                        add_vertex_buffer_impl< VTX, SLOT >( va, vb, bool_constant< vertex_has_slot< VTX, SLOT >::value >() );
    142142                }
    143143
     
    164164                }
    165165
     166                template < typename VTXDATA >
     167                enable_if_t< is_class< VTXDATA >::value, vertex_array >
     168                create_vertex_array( const VTXDATA& data, buffer_hint hint )
     169                {
     170                        return create_vertex_array( data.data(), data.size(), hint );
     171                }
     172
     173                template < typename VTXDATA, typename IDXDATA >
     174                enable_if_t< is_class< VTXDATA >::value && is_class< IDXDATA >::value, vertex_array >
     175                create_vertex_array( const VTXDATA& data, const IDXDATA& idata, buffer_hint hint )
     176                {
     177                        return create_vertex_array( data.data(), data.size(), idata.data(), idata.size(), hint );
     178                }
     179
    166180                template < typename VTX >
    167181                vertex_array create_vertex_array( const VTX* v, size_t count, buffer_hint hint )
     
    174188                }
    175189
    176                 template < typename VTX >
    177                 vertex_array create_vertex_array( const std::vector< VTX >& data, buffer_hint hint )
    178                 {
    179                         return create_vertex_array( data.data(), data.size(), hint );
    180                 }
    181 
    182190                template < typename VTX, typename IDX >
    183191                vertex_array create_vertex_array( const VTX* v, size_t vcount, const IDX* i, size_t icount, buffer_hint hint )
     
    187195                        set_index_buffer( va, ib, type_to_enum< IDX >::type, true );
    188196                        return va;
    189                 }
    190 
    191                 template < typename VTX, typename IDX >
    192                 vertex_array create_vertex_array( const std::vector< VTX >& data, const std::vector< IDX >& idata, buffer_hint hint )
    193                 {
    194                         return create_vertex_array( data.data(), data.size(), idata.data(), idata.size(), hint );
    195197                }
    196198
  • trunk/nv/interface/device.hh

    r379 r392  
    7373        };
    7474
    75         typedef std::unordered_map< std::string, attribute >    attribute_map;
     75        typedef unordered_map< std::string, attribute >    attribute_map;
    7676
    7777        struct texture_tag {};
     
    143143        struct program_info
    144144        {
    145                 attribute_map       m_attribute_map;
    146                 uniform_map             m_uniform_map;
    147                 engine_uniform_list m_engine_uniforms;
     145                attribute_map*       m_attribute_map;
     146                uniform_map*         m_uniform_map;
     147                engine_uniform_list* m_engine_uniforms;
    148148        };
    149149
     
    204204
    205205                template < typename T >
    206                 void set_opt_uniform_array( program p, const std::string& name, const std::vector<T>& value )
     206                void set_opt_uniform_array( program p, const std::string& name, const const_array_ref<T>& value )
    207207                {
    208208                        set_uniform_array( p, name, (const T*)value.data(), value.size(), false );
  • trunk/nv/interface/map_area.hh

    r379 r392  
    1616#include <nv/core/position.hh>
    1717#include <nv/stl/string.hh>
    18 #include <nv/stl/array.hh>
    1918#include <string>
    2019
  • trunk/nv/interface/mesh_data.hh

    r383 r392  
    1111#include <nv/stl/math.hh>
    1212#include <nv/stl/string.hh>
    13 #include <nv/stl/array.hh>
    1413#include <nv/gfx/animation.hh>
    1514#include <nv/interface/vertex.hh>
  • trunk/nv/interface/mesh_loader.hh

    r368 r392  
    1515
    1616#include <nv/core/common.hh>
    17 #include <nv/stl/array.hh>
    18 #include <unordered_map>
    1917#include <nv/core/transform.hh>
    2018#include <nv/stl/string.hh>
  • trunk/nv/interface/scene_node.hh

    r368 r392  
    1414
    1515#include <nv/core/common.hh>
    16 #include <nv/stl/array.hh>
     16#include <nv/stl/vector.hh>
    1717#include <nv/core/transform.hh>
    1818#include <nv/stl/math.hh>
     
    2525        {
    2626        public:
    27                 typedef std::vector< scene_node* > list;
     27                typedef vector< scene_node* > list;
    2828               
    2929                scene_node() {}
  • trunk/nv/interface/uniform.hh

    r379 r392  
    1616#include <nv/core/common.hh>
    1717#include <nv/stl/string.hh>
    18 #include <unordered_map>
    19 #include <string>
     18#include <nv/stl/unordered_map.hh>
    2019
    2120namespace nv
     
    149148        };
    150149
    151         typedef std::unordered_map< std::string, uniform_base* >                uniform_map;
    152         typedef std::vector< engine_uniform_base* >                        engine_uniform_list;
    153         typedef std::unordered_map< std::string, engine_uniform_factory_base* > engine_uniform_factory_map;
    154         typedef std::unordered_map< std::string, engine_link_uniform_base* >    engine_link_uniform_factory_map;
     150        typedef nv::unordered_map< std::string, uniform_base* >                uniform_map;
     151        typedef nv::vector< engine_uniform_base* >                        engine_uniform_list;
     152        // TODO - change to literal type map
     153        typedef nv::unordered_map< string_ref, engine_uniform_factory_base* > engine_uniform_factory_map;
     154        typedef nv::unordered_map< string_ref, engine_link_uniform_base* >    engine_link_uniform_factory_map;
    155155
    156156        class engine_uniform_m_view : public engine_uniform< mat4 >
  • trunk/nv/io/string_table.hh

    r368 r392  
    1414
    1515#include <nv/core/common.hh>
    16 #include <nv/stl/array.hh>
    17 #include <unordered_map>
     16#include <nv/stl/vector.hh>
     17#include <nv/stl/string.hh>
     18#include <nv/stl/unordered_map.hh>
    1819#include <nv/interface/stream.hh>
    1920
     
    8687                void clear();
    8788        private:
    88                 std::unordered_map< std::string, index > m_map;
    89                 std::vector< offset > m_offsets;
    90                 std::vector< char >   m_data;
     89                unordered_map< std::string, index > m_map;
     90                vector< offset > m_offsets;
     91                vector< char >   m_data;
    9192        };
    9293
  • trunk/nv/lua/lua_raw.hh

    r383 r392  
    88
    99#include <nv/core/common.hh>
    10 #include <nv/stl/array.hh>
     10#include <nv/stl/vector.hh>
    1111#include <nv/lib/lua.hh>
     12#include <string>
    1213
    1314void nlua_toflags_set( lua_State *L, int index, nv::uint8* data, nv::uint32 count );
  • trunk/nv/sdl/sdl_audio.hh

    r347 r392  
    3232                        virtual channel play_sound( sound a_sound, float volume = 1.0f, float pan = 0.0f );
    3333                        virtual channel play_sound( sound a_sound, vec3 position );
    34                         virtual sound load_sound( const std::string& a_path );
     34                        virtual sound load_sound( const string_ref& a_path );
    3535                        virtual void release( sound a_sound );
    3636                        virtual void set_orientation( vec3 forward, vec3 up );
  • trunk/nv/stl/cstring_store.hh

    r382 r392  
    1515
    1616#include <nv/core/common.hh>
     17#include <nv/stl/unordered_map.hh>
    1718#include <nv/stl/array.hh>
    1819#include <nv/stl/capi.hh>
    19 #include <unordered_map>
    2020
    2121namespace nv
     
    5959
    6060        template < typename T >
    61         using cstring_unordered_map = std::unordered_map < const char*, T, detail::cstring_hash, detail::cstring_compare > ;
     61        using cstring_unordered_map = unordered_map < const char*, T, detail::cstring_hash, detail::cstring_compare > ;
    6262
    6363        class cstring_store : public noncopyable
     
    112112                }
    113113        private:
    114                 std::vector< char* >            m_array;
     114                vector< char* >                 m_array;
    115115                cstring_unordered_map< uint32 > m_map;
    116116        };
  • trunk/nv/stl/handle.hh

    r383 r392  
    1414
    1515#include <nv/core/common.hh>
    16 #include <nv/stl/array.hh>
     16#include <nv/stl/vector.hh>
    1717
    1818namespace nv
  • trunk/nv/stl/string.hh

    r389 r392  
    2828#include <nv/stl/exception.hh>
    2929#include <nv/stl/algorithm.hh>
     30#include <nv/stl/functional/hash.hh>
    3031
    3132namespace nv
     
    3738//      string64
    3839//      string
     40
     41        template<>
     42        struct hash< std::string, size_t >
     43        {
     44                static size_t get( const std::string& value )
     45                {
     46                        return hash_string< size_t >( value.c_str(), value.length() );
     47                }
     48                inline size_t operator()( const std::string& value ) const { return get( value ); }
     49        };
    3950
    4051
     
    188199                inline size_t hash() const
    189200                {
    190                         const char* str = data();
    191                         size_type   sz  = size();
    192                         int seed = 131;
    193                         int result = 0;
    194                         while ( sz )
    195                         {
    196                                 result = ( result * seed ) + ( *str );
    197                                 str++;
    198                                 sz--;
    199                         }
    200                         return result & ( 0x7FFFFFFF );
     201                        return hash_string< size_t >( data(), size() );
    201202                }
    202203
     
    217218                }
    218219        };
     220
     221        template< typename H >
     222        struct hash< string_base, H >
     223        {
     224                static H get( const string_base& value )
     225                {
     226                        return hash_string< H >( value.data(), value.length() );
     227                }
     228                inline H operator()( const string_base& value ) const { return get( value ); }
     229        };
     230
     231        class literal_string : public string_base
     232        {
     233        public:
     234                // Literal constructors
     235                template< size_t N >
     236                inline literal_string( char( &s )[N] ) : string_base( s, N - 1 ) {}
     237                template< size_t N >
     238                inline literal_string( const char( &s )[N] ) : string_base( s, N - 1 ) {}
     239        };
     240
     241        template< typename H >
     242        struct hash< literal_string, H > : hash< string_base, H >{};
     243
    219244
    220245        class string_ref : public string_base
     
    280305
    281306        };
     307
     308        template< typename H >
     309        struct hash< string_ref, H > : hash< string_base, H >{};
    282310
    283311        // const string is movable but not copyable
  • trunk/nv/stl/type_traits/common.hh

    r389 r392  
    185185
    186186        template < typename T >
    187         constexpr T&& forward( typename remove_reference<T>::type& t )
     187        constexpr T&& forward( typename remove_reference<T>::type& t ) noexcept
    188188        {
    189189                return static_cast<T&&>( t );
  • trunk/src/fmod/fmod_audio.cc

    r365 r392  
    8888
    8989
    90 nv::sound fmod::audio::load_sound( const std::string& a_path )
     90nv::sound fmod::audio::load_sound( const string_ref& a_path )
    9191{
    9292        FMOD_SYSTEM* system = (FMOD_SYSTEM*)m_system;
    9393        FMOD_SOUND* sample;
    94         FMOD_RESULT fm_result = FMOD_System_CreateSound( system, a_path.c_str(), FMOD_3D, 0, &sample );
     94        FMOD_RESULT fm_result = FMOD_System_CreateSound( system, a_path.data(), FMOD_3D, 0, &sample );
    9595        if ( fm_result != FMOD_OK )
    9696        {
  • trunk/src/formats/assimp_loader.cc

    r383 r392  
    66
    77#include "nv/formats/assimp_loader.hh"
    8 #include <unordered_map>
    9 #include "nv/io/std_stream.hh"
     8#include "nv/stl/unordered_map.hh"
    109#include "nv/gfx/mesh_creator.hh"
    1110#include "nv/lib/assimp.hh"
     
    286285        const aiScene* scene = (const aiScene*)m_scene;
    287286        vector< mesh_node_data > final_bones;
    288         std::unordered_map< std::string, uint16 > names;
     287        unordered_map< std::string, uint16 > names;
    289288        for ( unsigned int m = 0; m < m_mesh_count; ++m )
    290289        {
     
    334333        }
    335334        mesh_node_data* bones = new mesh_node_data[ final_bones.size() ];
    336         nv::raw_copy( final_bones.begin(), final_bones.end(), bones );
     335        raw_copy( final_bones.begin(), final_bones.end(), bones );
    337336        return new mesh_nodes_data( "bones", final_bones.size(), bones );
    338337}
  • trunk/src/formats/md5_loader.cc

    r383 r392  
    66
    77#include "nv/core/logging.hh"
     8#include "nv/stl/vector.hh"
    89#include "nv/io/std_stream.hh"
    910
  • trunk/src/gfx/skeletal_mesh.cc

    r383 r392  
    77#include "nv/interface/context.hh"
    88#include "nv/interface/device.hh"
     9#include "nv/stl/unordered_map.hh"
    910
    1011nv::skeletal_mesh_cpu::skeletal_mesh_cpu( context* a_context, const mesh_data* a_mesh_data, const mesh_nodes_data* bones )
     
    8990        if ( !m_node_data->is_flat() )
    9091        {
    91                 m_children = new std::vector< uint32 >[ node_count ];
     92                m_children = new vector< uint32 >[ node_count ];
    9293                for ( uint32 n = 0; n < node_count; ++n )
    9394                {
     
    132133{
    133134        if ( m_prepared ) return;
    134         std::unordered_map< std::string, nv::uint16 > bone_names;
     135        unordered_map< std::string, nv::uint16 > bone_names;
    135136        m_offsets = new mat4[ bones->get_count() ];
    136137        for ( nv::uint16 bi = 0; bi < bones->get_count(); ++bi )
  • trunk/src/gl/gl_context.cc

    r376 r392  
    713713        if ( info )
    714714        {
    715                 for ( auto u : info->m_engine_uniforms )
     715                for ( auto& u : *info->m_engine_uniforms )
    716716                {
    717717                        u->set( this, &s );
  • trunk/src/gl/gl_device.cc

    r383 r392  
    1717        m_shader_header  = "#version 120\n";
    1818        for ( auto& i : get_uniform_factory() )
    19                 m_shader_header += "uniform "+datatype_to_glsl_type( i.second->get_datatype() )+" "+i.first+";\n";
     19                m_shader_header += "uniform "+datatype_to_glsl_type( i.second->get_datatype() )+" "+ i.first.to_string() +";\n";
    2020        for ( auto& i : get_link_uniform_factory() )
    21                 m_shader_header += "uniform sampler2D "+i.first+";\n";
     21                m_shader_header += "uniform sampler2D "+i.first.to_string() +";\n";
    2222}
    2323
     
    2626        program result = m_programs.create();
    2727        gl_program_info* info = m_programs.get( result );
     28
     29        info->m_attribute_map   = new attribute_map;
     30        info->m_engine_uniforms = new engine_uniform_list;
     31        info->m_uniform_map     = new uniform_map;
    2832
    2933        info->glid = glCreateProgram();
     
    179183        if ( info )
    180184        {
    181                 for ( auto& i : info->m_uniform_map )
     185                for ( auto& i : *info->m_uniform_map )
    182186                        delete i.second;
    183187
     
    188192                glDeleteProgram( info->glid );
    189193
     194                delete info->m_attribute_map;
     195                delete info->m_engine_uniforms;
     196                delete info->m_uniform_map;
     197
    190198                m_programs.destroy( p );
    191199        }
     
    200208                auto& lmap = get_link_uniform_factory();
    201209
    202                 for ( auto& i : info->m_uniform_map )
     210                for ( auto& i : *info->m_uniform_map )
    203211                {
    204212                        auto j = lmap.find( i.first );
     
    211219                        if ( k != map.end() )
    212220                        {
    213                                 info->m_engine_uniforms.push_back( k->second->create( i.second ) );
     221                                info->m_engine_uniforms->push_back( k->second->create( i.second ) );
    214222                        }                               
    215223                }
     
    221229        const gl_program_info* info = m_programs.get( p );
    222230        {
    223                 nv::uniform_map::const_iterator i = info->m_uniform_map.find( name );
    224                 if ( i != info->m_uniform_map.end() )
     231                nv::uniform_map::const_iterator i = info->m_uniform_map->find( name );
     232                if ( i != info->m_uniform_map->end() )
    225233                {
    226234                        return i->second;
     
    240248        if ( info )
    241249        {
    242                 attribute_map::const_iterator i = info->m_attribute_map.find( name );
    243                 if ( i != info->m_attribute_map.end() )
     250                attribute_map::const_iterator i = info->m_attribute_map->find( name );
     251                if ( i != info->m_attribute_map->end() )
    244252                {
    245253                        return i->second.location;
     
    307315void nv::gl_device::update_uniforms( gl_program_info* p )
    308316{
    309         for ( uniform_map::iterator i = p->m_uniform_map.begin();       i != p->m_uniform_map.end(); ++i )
    310         {
    311                 uniform_base* ubase = i->second;
     317        for ( auto& i : *p->m_uniform_map )
     318        {
     319                uniform_base* ubase = i.second;
    312320                if ( ubase->is_dirty() )
    313321                {
     
    354362                int attr_loc = glGetAttribLocation( p->glid, name.c_str() );
    355363
    356                 attribute& attr = p->m_attribute_map[ name ];
     364                attribute& attr = (*p->m_attribute_map)[ name ];
    357365                attr.name     = name;
    358366                attr.location = attr_loc;
     
    393401                uniform_base* u = uniform_base::create( utype, name, uni_loc, uni_len );
    394402                NV_ASSERT( u, "Unknown uniform type!" );
    395                 p->m_uniform_map[ name ] = u;
     403                (*p->m_uniform_map)[ name ] = u;
    396404        }
    397405}
  • trunk/src/gui/gui_environment.cc

    r380 r392  
    1414        TODO: parse a lua stylesheet as per Trac wiki
    1515
    16         IDEA: Store everything in std::unordered_maps, with lua_value's?
     16        IDEA: Store everything in unordered_maps, with lua_value's?
    1717
    1818        A lua_value is a variant stores strings as const char* that deletes them on destructor?
  • trunk/src/io/string_table.cc

    r383 r392  
    66
    77#include "nv/io/string_table.hh"
    8 #include <array>
    98
    109nv::string_table_creator::string_table_creator()
     
    2423        NV_ASSERT( m_offsets.size() < index(-1), "Too many strings!" );
    2524        index  result  = (index)m_offsets.size();
    26         m_offsets.push_back( m_data.size() );
    27         std::copy( cs, cs + cs_size, std::back_inserter( m_data ) );
     25        size_t dsize = m_data.size();
     26        m_offsets.push_back( dsize );
     27        m_data.resize( dsize + cs_size );
     28        raw_copy( cs, cs + cs_size, m_data.data() + dsize );
    2829        m_map[ s ] = result;
    2930        return result;
     
    3435        offset* offsets = new offset[m_offsets.size()];
    3536        char*   data    = new char [m_data.size()];
    36         std::copy( m_offsets.begin(), m_offsets.end(), offsets );
    37         std::copy( m_data.begin(),    m_data.end(),    data );
     37        raw_copy( m_offsets.begin(), m_offsets.end(), offsets );
     38        raw_copy( m_data.begin(),    m_data.end(),    data );
    3839        return new string_table( data, m_data.size(), offsets, (index)m_offsets.size() );
    3940}
  • trunk/src/sdl/sdl_audio.cc

    r368 r392  
    8585}
    8686
    87 nv::sound nv::sdl::audio::load_sound( const std::string& a_path )
     87nv::sound nv::sdl::audio::load_sound( const string_ref& a_path )
    8888{
    8989        // TODO: this is a really weird error - if we remove this check, all hell gets loose
     
    9292                NV_LOG_ERROR( "SDL_mixer not loaded!" );
    9393        }
    94         Mix_Chunk *sample = Mix_LoadWAV_RW(SDL_RWFromFile(a_path.c_str(), "rb"), 1);
     94        Mix_Chunk *sample = Mix_LoadWAV_RW(SDL_RWFromFile(a_path.data(), "rb"), 1);
    9595        if ( sample == nullptr )
    9696        {
Note: See TracChangeset for help on using the changeset viewer.