gloss and ior are now valid keys also in shader material dictionaries.

master
AnotherCommander 2018-08-18 22:09:43 +02:00
parent 5232e0a993
commit 360fc66373
3 changed files with 17 additions and 0 deletions

View File

@ -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;

View File

@ -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

View File

@ -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];