Ensure that gloss input in material dictionaries is always clamped between 0.0 and 1.0.

master
AnotherCommander 2018-09-26 12:21:09 +02:00
parent 1e73156d2e
commit 0509f8d8c0
2 changed files with 2 additions and 2 deletions

View File

@ -568,7 +568,7 @@ static void SynthSpecular(OOMaterialSynthContext *context)
else specularColor = [context->inConfig oo_specularColor];
if ([specularColor isBlack]) return;
SetUniformFloat(context, @"uGloss", [context->inConfig oo_gloss]);
SetUniformFloat(context, @"uGloss", gloss);
[context->outConfig setObject:[NSNumber numberWithUnsignedInt:shininess] forKey:kOOMaterialSpecularExponentLegacyName];

View File

@ -236,7 +236,7 @@ NSString * const kOOMaterialLightMapsName = @"light_map";
- (float) oo_gloss
{
return [self oo_floatForKey:kOOMaterialGlossName defaultValue:0.375f];
return OOClamp_0_1_f([self oo_floatForKey:kOOMaterialGlossName defaultValue:0.375f]);
}