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


File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.