- Timestamp:
- 06/11/15 16:23:41 (10 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
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.