Changeset 392 for trunk/src


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


Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • 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.