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.

master
AnotherCommander 2018-08-19 23:55:14 +02:00
parent 10df924f5d
commit 23af0abaa6
1 changed files with 12 additions and 6 deletions

View File

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