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,12 +261,18 @@ 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
float gloss = OOClamp_0_1_f([configuration oo_floatForKey:@"gloss" defaultValue:0.5f]); if (![uniforms objectForKey:@"uGloss"])
[self setUniform:@"uGloss" floatValue:gloss]; {
float gloss = OOClamp_0_1_f([configuration oo_floatForKey:@"gloss" defaultValue:0.5f]);
[self setUniform:@"uGloss" floatValue:gloss];
}
float ior = [configuration oo_floatForKey:@"ior" defaultValue:1.0f]; if (![uniforms objectForKey:@"uIOR"])
if (ior <= 0.0f) ior = 0.001f; {
[self setUniform:@"uIOR" floatValue:ior]; float ior = [configuration oo_floatForKey:@"ior" defaultValue:1.0f];
if (ior <= 0.0f) ior = 0.001f;
[self setUniform:@"uIOR" floatValue:ior];
}
} }
if (!OK) if (!OK)