BGE: Add integer uniforms for 2D Filter

Actually it is only possible to pass float properties to a 2D filter (GLSL fragment shader).
This patch allows also to use integer properties for the 2D filter.

Reviewers: sybren, agoose77, kupoman, moguri, lordloki, panzergame

Reviewed By: lordloki, panzergame

Projects: #game_engine

Differential Revision: https://developer.blender.org/D1370
This commit is contained in:
Thomas Szepe 2015-07-03 17:07:31 +02:00
parent 1ace3272aa
commit 97b431e42d
1 changed files with 18 additions and 4 deletions

View File

@ -257,10 +257,24 @@ void RAS_2DFilterManager::StartShaderProgram(int passindex)
for (i=0; i<objProperties; i++)
{
uniformLoc = glGetUniformLocationARB(m_filters[passindex], m_properties[passindex][i]);
if (uniformLoc != -1)
{
float value = ((CValue*)m_gameObjects[passindex])->GetPropertyNumber(m_properties[passindex][i], 0.0);
glUniform1fARB(uniformLoc,value);
if (uniformLoc == -1)
continue;
CValue *property = ((CValue *)m_gameObjects[passindex])->GetProperty(m_properties[passindex][i]);
if (!property)
continue;
switch (property->GetValueType()) {
case VALUE_INT_TYPE:
glUniform1iARB(uniformLoc, property->GetNumber());
break;
case VALUE_FLOAT_TYPE:
glUniform1fARB(uniformLoc, property->GetNumber());
break;
default:
break;
}
}
}