Commit 204680e3 authored by Jan Möbius's avatar Jan Möbius
Browse files

Added the possibility to pass unfiforms via render objects to the IRenderer

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16395 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 9ddbdb28
......@@ -314,6 +314,24 @@ void IRenderer::bindObjectUniforms( ACG::RenderObject* _obj, GLSL::Program* _pro
_prog->setUniform("g_vMaterial", materialParams);
// Additional Uniforms defined in the render Object
for ( QMap<QString, QPair<unsigned int, QVariant> >::iterator additionalUniformsIter = _obj->additionalUniforms_.begin();
additionalUniformsIter != _obj->additionalUniforms_.end(); ++additionalUniformsIter ) {
switch (additionalUniformsIter.value().first) {
case GL_FLOAT:
_prog->setUniform(additionalUniformsIter.key().toAscii(),additionalUniformsIter.value().second.toFloat());
break;
case GL_INT:
_prog->setUniform(additionalUniformsIter.key().toAscii(),additionalUniformsIter.value().second.toInt());
break;
default:
std::cerr << "IRenderer Error: Additional Uniform data type not supported" << std::endl;
break;
}
}
// texture
glActiveTexture(GL_TEXTURE0);
......
......@@ -299,6 +299,19 @@ struct ACGDLLEXPORT RenderObject
*
*/
void setGeometryShaderInputFromDrawCall(GLenum _mode);
/** \brief set values for uniforms
*
* @param _uniformName Name of uniform in shader
* @param _dataType Type of value (GL_INT, GL_FLOAT)
* @param _value QVariant encapsuled value of the type
*
*/
void addUniformValue(QString _uniformName, unsigned int _dataType, QVariant value) {
additionalUniforms_[_uniformName] = QPair<unsigned int, QVariant>( _dataType, value );
}
QMap<QString, QPair<unsigned int, QVariant> > additionalUniforms_;
};
//=============================================================================
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment