diff --git a/src/Core/Materials/OOMaterialSpecifier.h b/src/Core/Materials/OOMaterialSpecifier.h index 22bd08fc..ace95cfd 100644 --- a/src/Core/Materials/OOMaterialSpecifier.h +++ b/src/Core/Materials/OOMaterialSpecifier.h @@ -91,6 +91,9 @@ extern NSString * const kOOMaterialEmissionAndIlluminationMapName; extern NSString * const kOOMaterialParallaxScaleName; extern NSString * const kOOMaterialParallaxBiasName; +extern NSString * const kOOMaterialIORName; +extern NSString * const kOOMaterialGlossName; + extern NSString * const kOOMaterialSpecularExponentName; extern NSString * const kOOMaterialSpecularExponentLegacyName; diff --git a/src/Core/Materials/OOShaderMaterial.h b/src/Core/Materials/OOShaderMaterial.h index 7fec950e..5d9d26da 100644 --- a/src/Core/Materials/OOShaderMaterial.h +++ b/src/Core/Materials/OOShaderMaterial.h @@ -77,6 +77,8 @@ typedef uint16_t OOUniformConvertOptions; dictionaries containing: type "int", "texture" or "float" value number + gloss gloss value of material, float between 0.0 and 1.0, defaults to 0.5 + ior index of refraction of material, positive float, defaults to 1.0 Macros is a dictionary which is converted to macro definitions and prepended to shader source code. It should be used to specify the diff --git a/src/Core/Materials/OOShaderMaterial.m b/src/Core/Materials/OOShaderMaterial.m index 69b477d5..457f8e7f 100644 --- a/src/Core/Materials/OOShaderMaterial.m +++ b/src/Core/Materials/OOShaderMaterial.m @@ -257,6 +257,18 @@ static NSString *MacrosToString(NSDictionary *macros); [self addTexturesFromArray:textureArray unitCount:textureUnits]; } + 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 (!OK) { [self release];