Changeset 50 for trunk/nv/interface/program.hh
- Timestamp:
- 05/28/13 22:29:08 (12 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.