Changeset 50
- Timestamp:
- 05/28/13 22:29:08 (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/interface/program.hh
r41 r50 15 15 #include <unordered_map> 16 16 #include <nv/logging.hh> 17 #include <nv/exception.hh> 17 18 #include <nv/common.hh> 18 19 #include <nv/string.hh> … … 108 109 i != m_uniform_map.end(); ++i ) delete i->second; 109 110 } 111 attribute* try_get_attribute( const string& name ) const 112 { 113 attribute_map::const_iterator i = m_attribute_map.find( name ); 114 if ( i != m_attribute_map.end() ) 115 { 116 return i->second; 117 } 118 return nullptr; 119 } 120 110 121 attribute* get_attribute( const string& name ) const 111 122 { 112 123 attribute_map::const_iterator i = m_attribute_map.find( name ); 113 124 if ( i != m_attribute_map.end() ) 125 { 126 return i->second; 127 } 128 NV_LOG( LOG_ERROR, "Attribute '" << name << "' not found in program!" ); 129 throw runtime_error( "Attribute '"+name+"' not found!" ); 130 } 131 132 uniform_base* try_get_uniform( const string& name ) const 133 { 134 uniform_map::const_iterator i = m_uniform_map.find( name ); 135 if ( i != m_uniform_map.end() ) 114 136 { 115 137 return i->second; … … 125 147 return i->second; 126 148 } 127 return nullptr; 149 NV_LOG( LOG_ERROR, "Uniform '" << name << "' not found in program!" ); 150 throw runtime_error( "Uniform '"+name+"' not found!" ); 128 151 } 129 152 … … 133 156 uniform_base* base = get_uniform( name ); 134 157 // restore typechecking, but remember to accept int for float! 135 if ( base == nullptr /* ||base->get_type() != type_to_enum<T>::type */ )136 {137 NV_LOG( LOG_ERROR, "Uniform '" << name << "' not found in program!" );138 return;139 }158 // if ( /* base->get_type() != type_to_enum<T>::type */ ) 159 // { 160 // NV_LOG( LOG_ERROR, "Uniform '" << name << "' not found in program!" ); 161 // return; 162 // } 140 163 ((uniform<T>*)( base ))->set_value( value ); 141 164 } -
trunk/tests/render_test/rl.cc
r49 r50 186 186 va = m_device->create_vertex_array(); 187 187 188 nv::attribute* a;189 a = p->get_attribute( "coords" ); if (a == nullptr) return false;190 188 nv::vertex_buffer* vbcoords = m_device->create_vertex_buffer( nv::STATIC_DRAW, count*sizeof(byte3), vertex ); 191 va->add_vertex_buffer( a->get_location(), vbcoords, nv::BYTE, 3 ); 192 193 a = p->get_attribute( "material" ); if (a == nullptr) return false; 189 va->add_vertex_buffer( p->get_attribute( "coords" )->get_location(), vbcoords, nv::BYTE, 3 ); 194 190 nv::vertex_buffer* vbmaterial = m_device->create_vertex_buffer( nv::STATIC_DRAW, count*sizeof(byte3), material ); 195 va->add_vertex_buffer( a->get_location(), vbmaterial, nv::BYTE, 3 );191 va->add_vertex_buffer( p->get_attribute( "material" )->get_location(), vbmaterial, nv::BYTE, 3 ); 196 192 197 193 return true;
Note: See TracChangeset
for help on using the changeset viewer.