Changeset 392
- Timestamp:
- 06/11/15 16:23:41 (10 years ago)
- Location:
- trunk
- Files:
-
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/core/profiler.hh
r383 r392 17 17 #include <nv/stl/singleton.hh> 18 18 #include <nv/stl/string.hh> 19 #include < unordered_map>19 #include <nv/stl/unordered_map.hh> 20 20 21 21 #if NV_PROFILER … … 50 50 ~node(); 51 51 protected: 52 typedef std::unordered_map< std::string, node* > map;52 typedef unordered_map< std::string, node* > map; 53 53 54 54 std::string m_tag; -
trunk/nv/core/types.hh
r385 r392 9 9 #include <nv/stl/math.hh> 10 10 #include <nv/stl/memory.hh> 11 #include <nv/stl/vector.hh> 12 #include <nv/stl/unordered_map.hh> 11 13 #include <nv/stl/cstring_store.hh> 12 14 #include <nv/stl/type_traits/properties.hh> 13 #include <unordered_map>14 #include <vector>15 15 16 16 namespace nv … … 78 78 size_t size; //!< Result of sizeof(type) operation 79 79 type_entry* base_type; //!< Base type 80 std::vector<type_field> field_list; //!< Field list81 std::vector<type_enum> enum_list; //!< Enum list80 vector<type_field> field_list; //!< Field list 81 vector<type_enum> enum_list; //!< Enum list 82 82 cstring_store names; 83 83 }; … … 154 154 } 155 155 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; 158 158 cstring_store m_names; 159 159 type_list m_type_list; -
trunk/nv/core/uid.hh
r379 r392 15 15 16 16 #include <nv/core/common.hh> 17 #include < unordered_map>17 #include <nv/stl/unordered_map.hh> 18 18 19 19 namespace nv … … 74 74 75 75 protected: 76 typedef std::unordered_map< uid, void* > map;76 typedef unordered_map< uid, void* > map; 77 77 map m_map; ///< The hash map everything is stored in. 78 78 uid m_current; ///< The last UID assigned. -
trunk/nv/engine/particle_engine.hh
r368 r392 10 10 #include <nv/core/common.hh> 11 11 #include <nv/stl/math.hh> 12 #include <nv/stl/array.hh> 12 #include <nv/stl/vector.hh> 13 #include <nv/stl/unordered_map.hh> 13 14 #include <nv/stl/handle.hh> 14 15 #include <nv/lua/lua_state.hh> … … 194 195 195 196 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; 200 201 }; 201 202 -
trunk/nv/fmod/fmod_audio.hh
r347 r392 34 34 virtual channel play_sound( sound a_sound, float volume = 1.0f, float pan = 0.0f ); 35 35 virtual channel play_sound( sound a_sound, vec3 position ); 36 virtual sound load_sound( const st d::string& a_path );36 virtual sound load_sound( const string_ref& a_path ); 37 37 virtual void release( sound a_sound ); 38 38 virtual void set_orientation( vec3 forward, vec3 up ); -
trunk/nv/formats/md2_loader.hh
r383 r392 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/stl/ array.hh>17 #include <nv/stl/vector.hh> 18 18 #include <nv/interface/mesh_loader.hh> 19 19 -
trunk/nv/formats/md3_loader.hh
r383 r392 15 15 16 16 #include <nv/core/common.hh> 17 #include <unordered_map>18 #include <nv/stl/array.hh>19 17 #include <nv/core/transform.hh> 20 18 #include <nv/interface/mesh_data.hh> -
trunk/nv/formats/nmd_loader.hh
r319 r392 11 11 #include <nv/interface/mesh_loader.hh> 12 12 #include <nv/interface/mesh_data.hh> 13 #include <nv/stl/vector.hh> 13 14 #include <nv/io/string_table.hh> 14 15 … … 86 87 mesh_node_data* m_node_array; 87 88 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; 91 92 }; 92 93 -
trunk/nv/formats/obj_loader.hh
r383 r392 17 17 #include <nv/interface/mesh_loader.hh> 18 18 #include <nv/interface/mesh_data.hh> 19 #include <nv/stl/vector.hh> 19 20 20 21 namespace nv -
trunk/nv/gfx/animation.hh
r368 r392 9 9 10 10 #include <nv/core/common.hh> 11 #include <nv/stl/ array.hh>11 #include <nv/stl/vector.hh> 12 12 #include <nv/interface/stream.hh> 13 13 #include <nv/stl/math.hh> … … 198 198 private: 199 199 key_descriptor m_final_key; 200 std::vector< key_raw_channel* > m_channels;200 vector< key_raw_channel* > m_channels; 201 201 }; 202 202 -
trunk/nv/gfx/debug_draw.hh
r368 r392 10 10 #include <nv/core/common.hh> 11 11 #include <nv/stl/math.hh> 12 #include <nv/stl/vector.hh> 12 13 #include <nv/interface/context.hh> 13 14 … … 37 38 ~debug_data(); 38 39 private: 39 context* 40 program 41 vertex_array 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; 43 44 }; 44 45 -
trunk/nv/gfx/skeletal_mesh.hh
r323 r392 90 90 protected: 91 91 const mesh_nodes_data* m_node_data; 92 std::vector< uint32 >* m_children;92 vector< uint32 >* m_children; 93 93 sint16* m_bone_ids; 94 94 mat4* m_offsets; -
trunk/nv/gfx/sliced_buffer.hh
r368 r392 13 13 #include <nv/core/common.hh> 14 14 #include <nv/stl/math.hh> 15 #include <vector> // TODO: remove 15 16 16 17 namespace nv … … 23 24 { 24 25 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 ) 29 31 : m_cache( c ), m_offset( 0 ), m_cached_size( 0 ), m_locked( true ) 30 32 { … … 63 65 } 64 66 65 vector & lock()67 vector_type& lock() 66 68 { 67 69 m_locked = true; 68 70 return m_data; 69 71 } 70 const vector & data()72 const vector_type& data() 71 73 { 72 74 return m_data; … … 77 79 } 78 80 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; 84 86 }; 85 87 … … 88 90 { 89 91 public: 90 typedef std::vector<T> vector ;92 typedef std::vector<T> vector_type; 91 93 typedef T value_type; 92 94 static const size_t value_type_size = sizeof(T); … … 106 108 } 107 109 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 ) 109 111 { 110 112 if ( !m_full_update && resized ) … … 121 123 else if ( updated ) 122 124 { 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 ); 124 127 m_min = nv::min<size_t>( m_min, offset ); 125 128 m_max = nv::max<size_t>( m_max, offset + bv.size() ); … … 208 211 buffer_hint m_hint; 209 212 bool m_full_update; 210 vector 213 vector_type m_data; 211 214 uint32 m_capacity; 212 215 … … 224 227 typedef buffer_slice<T> vertex_slice; 225 228 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; 228 231 229 232 indexed_buffer_slice( cache* c ) -
trunk/nv/gui/gui_environment.hh
r379 r392 19 19 #include <nv/core/io_event.hh> 20 20 #include <nv/interface/window.hh> 21 #include <nv/stl/array.hh>22 21 23 22 namespace nv -
trunk/nv/interface/audio.hh
r368 r392 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/stl/string.hh> 16 17 #include <nv/stl/math.hh> 17 18 #include <nv/stl/handle.hh> … … 31 32 virtual channel play_sound( sound a_sound, vec3 position ) = 0; 32 33 // temporary - use streams later 33 virtual sound load_sound( const st d::string& a_path ) = 0;34 virtual sound load_sound( const string_ref& a_path ) = 0; 34 35 virtual void release( sound a_sound ) = 0; 35 36 virtual void set_orientation( vec3 forward, vec3 up ) = 0; -
trunk/nv/interface/context.hh
r383 r392 124 124 125 125 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& ) 127 127 { 128 128 } 129 129 130 130 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& ) 132 132 { 133 133 typedef vertex_slot_info< VTX, SLOT > vinfo; … … 139 139 void add_vertex_buffer( vertex_array va, buffer vb ) 140 140 { 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 >() ); 142 142 } 143 143 … … 164 164 } 165 165 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 166 180 template < typename VTX > 167 181 vertex_array create_vertex_array( const VTX* v, size_t count, buffer_hint hint ) … … 174 188 } 175 189 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 182 190 template < typename VTX, typename IDX > 183 191 vertex_array create_vertex_array( const VTX* v, size_t vcount, const IDX* i, size_t icount, buffer_hint hint ) … … 187 195 set_index_buffer( va, ib, type_to_enum< IDX >::type, true ); 188 196 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 );195 197 } 196 198 -
trunk/nv/interface/device.hh
r379 r392 73 73 }; 74 74 75 typedef std::unordered_map< std::string, attribute > attribute_map;75 typedef unordered_map< std::string, attribute > attribute_map; 76 76 77 77 struct texture_tag {}; … … 143 143 struct program_info 144 144 { 145 attribute_map m_attribute_map;146 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; 148 148 }; 149 149 … … 204 204 205 205 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 ) 207 207 { 208 208 set_uniform_array( p, name, (const T*)value.data(), value.size(), false ); -
trunk/nv/interface/map_area.hh
r379 r392 16 16 #include <nv/core/position.hh> 17 17 #include <nv/stl/string.hh> 18 #include <nv/stl/array.hh>19 18 #include <string> 20 19 -
trunk/nv/interface/mesh_data.hh
r383 r392 11 11 #include <nv/stl/math.hh> 12 12 #include <nv/stl/string.hh> 13 #include <nv/stl/array.hh>14 13 #include <nv/gfx/animation.hh> 15 14 #include <nv/interface/vertex.hh> -
trunk/nv/interface/mesh_loader.hh
r368 r392 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/stl/array.hh>18 #include <unordered_map>19 17 #include <nv/core/transform.hh> 20 18 #include <nv/stl/string.hh> -
trunk/nv/interface/scene_node.hh
r368 r392 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/stl/ array.hh>16 #include <nv/stl/vector.hh> 17 17 #include <nv/core/transform.hh> 18 18 #include <nv/stl/math.hh> … … 25 25 { 26 26 public: 27 typedef std::vector< scene_node* > list;27 typedef vector< scene_node* > list; 28 28 29 29 scene_node() {} -
trunk/nv/interface/uniform.hh
r379 r392 16 16 #include <nv/core/common.hh> 17 17 #include <nv/stl/string.hh> 18 #include <unordered_map> 19 #include <string> 18 #include <nv/stl/unordered_map.hh> 20 19 21 20 namespace nv … … 149 148 }; 150 149 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; 155 155 156 156 class engine_uniform_m_view : public engine_uniform< mat4 > -
trunk/nv/io/string_table.hh
r368 r392 14 14 15 15 #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> 18 19 #include <nv/interface/stream.hh> 19 20 … … 86 87 void clear(); 87 88 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; 91 92 }; 92 93 -
trunk/nv/lua/lua_raw.hh
r383 r392 8 8 9 9 #include <nv/core/common.hh> 10 #include <nv/stl/ array.hh>10 #include <nv/stl/vector.hh> 11 11 #include <nv/lib/lua.hh> 12 #include <string> 12 13 13 14 void nlua_toflags_set( lua_State *L, int index, nv::uint8* data, nv::uint32 count ); -
trunk/nv/sdl/sdl_audio.hh
r347 r392 32 32 virtual channel play_sound( sound a_sound, float volume = 1.0f, float pan = 0.0f ); 33 33 virtual channel play_sound( sound a_sound, vec3 position ); 34 virtual sound load_sound( const st d::string& a_path );34 virtual sound load_sound( const string_ref& a_path ); 35 35 virtual void release( sound a_sound ); 36 36 virtual void set_orientation( vec3 forward, vec3 up ); -
trunk/nv/stl/cstring_store.hh
r382 r392 15 15 16 16 #include <nv/core/common.hh> 17 #include <nv/stl/unordered_map.hh> 17 18 #include <nv/stl/array.hh> 18 19 #include <nv/stl/capi.hh> 19 #include <unordered_map>20 20 21 21 namespace nv … … 59 59 60 60 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 > ; 62 62 63 63 class cstring_store : public noncopyable … … 112 112 } 113 113 private: 114 std::vector< char* >m_array;114 vector< char* > m_array; 115 115 cstring_unordered_map< uint32 > m_map; 116 116 }; -
trunk/nv/stl/handle.hh
r383 r392 14 14 15 15 #include <nv/core/common.hh> 16 #include <nv/stl/ array.hh>16 #include <nv/stl/vector.hh> 17 17 18 18 namespace nv -
trunk/nv/stl/string.hh
r389 r392 28 28 #include <nv/stl/exception.hh> 29 29 #include <nv/stl/algorithm.hh> 30 #include <nv/stl/functional/hash.hh> 30 31 31 32 namespace nv … … 37 38 // string64 38 39 // 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 }; 39 50 40 51 … … 188 199 inline size_t hash() const 189 200 { 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() ); 201 202 } 202 203 … … 217 218 } 218 219 }; 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 219 244 220 245 class string_ref : public string_base … … 280 305 281 306 }; 307 308 template< typename H > 309 struct hash< string_ref, H > : hash< string_base, H >{}; 282 310 283 311 // const string is movable but not copyable -
trunk/nv/stl/type_traits/common.hh
r389 r392 185 185 186 186 template < typename T > 187 constexpr T&& forward( typename remove_reference<T>::type& t ) 187 constexpr T&& forward( typename remove_reference<T>::type& t ) noexcept 188 188 { 189 189 return static_cast<T&&>( t ); -
trunk/src/fmod/fmod_audio.cc
r365 r392 88 88 89 89 90 nv::sound fmod::audio::load_sound( const st d::string& a_path )90 nv::sound fmod::audio::load_sound( const string_ref& a_path ) 91 91 { 92 92 FMOD_SYSTEM* system = (FMOD_SYSTEM*)m_system; 93 93 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 ); 95 95 if ( fm_result != FMOD_OK ) 96 96 { -
trunk/src/formats/assimp_loader.cc
r383 r392 6 6 7 7 #include "nv/formats/assimp_loader.hh" 8 #include <unordered_map> 9 #include "nv/io/std_stream.hh" 8 #include "nv/stl/unordered_map.hh" 10 9 #include "nv/gfx/mesh_creator.hh" 11 10 #include "nv/lib/assimp.hh" … … 286 285 const aiScene* scene = (const aiScene*)m_scene; 287 286 vector< mesh_node_data > final_bones; 288 std::unordered_map< std::string, uint16 > names;287 unordered_map< std::string, uint16 > names; 289 288 for ( unsigned int m = 0; m < m_mesh_count; ++m ) 290 289 { … … 334 333 } 335 334 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 ); 337 336 return new mesh_nodes_data( "bones", final_bones.size(), bones ); 338 337 } -
trunk/src/formats/md5_loader.cc
r383 r392 6 6 7 7 #include "nv/core/logging.hh" 8 #include "nv/stl/vector.hh" 8 9 #include "nv/io/std_stream.hh" 9 10 -
trunk/src/gfx/skeletal_mesh.cc
r383 r392 7 7 #include "nv/interface/context.hh" 8 8 #include "nv/interface/device.hh" 9 #include "nv/stl/unordered_map.hh" 9 10 10 11 nv::skeletal_mesh_cpu::skeletal_mesh_cpu( context* a_context, const mesh_data* a_mesh_data, const mesh_nodes_data* bones ) … … 89 90 if ( !m_node_data->is_flat() ) 90 91 { 91 m_children = new std::vector< uint32 >[ node_count ];92 m_children = new vector< uint32 >[ node_count ]; 92 93 for ( uint32 n = 0; n < node_count; ++n ) 93 94 { … … 132 133 { 133 134 if ( m_prepared ) return; 134 std::unordered_map< std::string, nv::uint16 > bone_names;135 unordered_map< std::string, nv::uint16 > bone_names; 135 136 m_offsets = new mat4[ bones->get_count() ]; 136 137 for ( nv::uint16 bi = 0; bi < bones->get_count(); ++bi ) -
trunk/src/gl/gl_context.cc
r376 r392 713 713 if ( info ) 714 714 { 715 for ( auto u :info->m_engine_uniforms )715 for ( auto& u : *info->m_engine_uniforms ) 716 716 { 717 717 u->set( this, &s ); -
trunk/src/gl/gl_device.cc
r383 r392 17 17 m_shader_header = "#version 120\n"; 18 18 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"; 20 20 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"; 22 22 } 23 23 … … 26 26 program result = m_programs.create(); 27 27 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; 28 32 29 33 info->glid = glCreateProgram(); … … 179 183 if ( info ) 180 184 { 181 for ( auto& i : info->m_uniform_map )185 for ( auto& i : *info->m_uniform_map ) 182 186 delete i.second; 183 187 … … 188 192 glDeleteProgram( info->glid ); 189 193 194 delete info->m_attribute_map; 195 delete info->m_engine_uniforms; 196 delete info->m_uniform_map; 197 190 198 m_programs.destroy( p ); 191 199 } … … 200 208 auto& lmap = get_link_uniform_factory(); 201 209 202 for ( auto& i : info->m_uniform_map )210 for ( auto& i : *info->m_uniform_map ) 203 211 { 204 212 auto j = lmap.find( i.first ); … … 211 219 if ( k != map.end() ) 212 220 { 213 info->m_engine_uniforms .push_back( k->second->create( i.second ) );221 info->m_engine_uniforms->push_back( k->second->create( i.second ) ); 214 222 } 215 223 } … … 221 229 const gl_program_info* info = m_programs.get( p ); 222 230 { 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() ) 225 233 { 226 234 return i->second; … … 240 248 if ( info ) 241 249 { 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() ) 244 252 { 245 253 return i->second.location; … … 307 315 void nv::gl_device::update_uniforms( gl_program_info* p ) 308 316 { 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; 312 320 if ( ubase->is_dirty() ) 313 321 { … … 354 362 int attr_loc = glGetAttribLocation( p->glid, name.c_str() ); 355 363 356 attribute& attr = p->m_attribute_map[ name ];364 attribute& attr = (*p->m_attribute_map)[ name ]; 357 365 attr.name = name; 358 366 attr.location = attr_loc; … … 393 401 uniform_base* u = uniform_base::create( utype, name, uni_loc, uni_len ); 394 402 NV_ASSERT( u, "Unknown uniform type!" ); 395 p->m_uniform_map[ name ] = u;403 (*p->m_uniform_map)[ name ] = u; 396 404 } 397 405 } -
trunk/src/gui/gui_environment.cc
r380 r392 14 14 TODO: parse a lua stylesheet as per Trac wiki 15 15 16 IDEA: Store everything in std::unordered_maps, with lua_value's?16 IDEA: Store everything in unordered_maps, with lua_value's? 17 17 18 18 A lua_value is a variant stores strings as const char* that deletes them on destructor? -
trunk/src/io/string_table.cc
r383 r392 6 6 7 7 #include "nv/io/string_table.hh" 8 #include <array>9 8 10 9 nv::string_table_creator::string_table_creator() … … 24 23 NV_ASSERT( m_offsets.size() < index(-1), "Too many strings!" ); 25 24 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 ); 28 29 m_map[ s ] = result; 29 30 return result; … … 34 35 offset* offsets = new offset[m_offsets.size()]; 35 36 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 ); 38 39 return new string_table( data, m_data.size(), offsets, (index)m_offsets.size() ); 39 40 } -
trunk/src/sdl/sdl_audio.cc
r368 r392 85 85 } 86 86 87 nv::sound nv::sdl::audio::load_sound( const st d::string& a_path )87 nv::sound nv::sdl::audio::load_sound( const string_ref& a_path ) 88 88 { 89 89 // TODO: this is a really weird error - if we remove this check, all hell gets loose … … 92 92 NV_LOG_ERROR( "SDL_mixer not loaded!" ); 93 93 } 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); 95 95 if ( sample == nullptr ) 96 96 {
Note: See TracChangeset
for help on using the changeset viewer.