Fixed shader gloss and ior uniforms overriding material definitions of the same. Now both shaders and materials definitions of those uniforms should work nicwly together.

This commit is contained in:
AnotherCommander 2018-08-19 23:55:14 +02:00
parent 10df924f5d
commit 23af0abaa6

View File

@ -261,13 +261,19 @@ static NSString *MacrosToString(NSDictionary *macros);
{ {
// write gloss and index of refraction to the uniforms dictionary // write gloss and index of refraction to the uniforms dictionary
if (![uniforms objectForKey:@"uGloss"])
{
float gloss = OOClamp_0_1_f([configuration oo_floatForKey:@"gloss" defaultValue:0.5f]); float gloss = OOClamp_0_1_f([configuration oo_floatForKey:@"gloss" defaultValue:0.5f]);
[self setUniform:@"uGloss" floatValue:gloss]; [self setUniform:@"uGloss" floatValue:gloss];
}
if (![uniforms objectForKey:@"uIOR"])
{
float ior = [configuration oo_floatForKey:@"ior" defaultValue:1.0f]; float ior = [configuration oo_floatForKey:@"ior" defaultValue:1.0f];
if (ior <= 0.0f) ior = 0.001f; if (ior <= 0.0f) ior = 0.001f;
[self setUniform:@"uIOR" floatValue:ior]; [self setUniform:@"uIOR" floatValue:ior];
} }
}
if (!OK) if (!OK)
{ {