Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
NSDictionary(OOMateralProperties) Category Reference

#include <OOMaterialSpecifier.h>

Instance Methods

(OOColor *) - oo_diffuseColor
 
(OOColor *) - oo_ambientColor
 
(OOColor *) - oo_specularColor
 
(OOColor *) - oo_specularModulateColor
 
(OOColor *) - oo_emissionColor
 
(OOColor *) - oo_emissionModulateColor
 
(OOColor *) - oo_illuminationModulateColor
 
(NSDictionary *) - oo_diffuseMapSpecifierWithDefaultName:
 
(NSDictionary *) - oo_combinedSpecularMapSpecifier
 
(NSDictionary *) - oo_specularColorMapSpecifier
 
(NSDictionary *) - oo_specularExponentMapSpecifier
 
(NSDictionary *) - oo_normalMapSpecifier
 
(NSDictionary *) - oo_parallaxMapSpecifier
 
(NSDictionary *) - oo_normalAndParallaxMapSpecifier
 
(NSDictionary *) - oo_emissionMapSpecifier
 
(NSDictionary *) - oo_illuminationMapSpecifier
 
(NSDictionary *) - oo_emissionAndIlluminationMapSpecifier
 
(float) - oo_parallaxScale
 
(float) - oo_parallaxBias
 
(BOOL) - oo_gammaCorrect
 
(float) - oo_gloss
 
(int- oo_specularExponent
 
(int- oo_rawSpecularExponentValue [implementation]
 

Detailed Description

Definition at line 36 of file OOMaterialSpecifier.h.

Method Documentation

◆ oo_ambientColor

- (OOColor *) oo_ambientColor

Definition at line 69 of file OOMaterialSpecifier.m.

94{
95 OOColor *result = [OOColor colorWithDescription:[self objectForKey:kOOMaterialAmbientColorName]];
96 if (result == nil) result = [OOColor colorWithDescription:[self objectForKey:kOOMaterialAmbientColorLegacyName]];
97 return result;
98}
return nil
OOColor * colorWithDescription:(id description)
Definition OOColor.m:127

References nil.

◆ oo_combinedSpecularMapSpecifier

- (NSDictionary *) oo_combinedSpecularMapSpecifier

Definition at line 69 of file OOMaterialSpecifier.m.

157{
158 if ([self oo_rawSpecularExponentValue] == 0) return nil;
159 return [self oo_textureSpecifierForKey:kOOMaterialCombinedSpecularMapName defaultName:nil];
160}

◆ oo_diffuseColor

- (OOColor *) oo_diffuseColor

Definition at line 69 of file OOMaterialSpecifier.m.

84{
85 OOColor *result = [OOColor colorWithDescription:[self objectForKey:kOOMaterialDiffuseColorName]];
86 if (result == nil) result = [OOColor colorWithDescription:[self objectForKey:kOOMaterialDiffuseColorLegacyName]];
87
88 if ([result isWhite]) result = nil;
89 return result;
90}

◆ oo_diffuseMapSpecifierWithDefaultName:

- (NSDictionary *) oo_diffuseMapSpecifierWithDefaultName: (NSString *) name

Definition at line 69 of file OOMaterialSpecifier.m.

150 :(NSString *)name
151{
152 return [self oo_textureSpecifierForKey:kOOMaterialDiffuseMapName defaultName:name];
153}

◆ oo_emissionAndIlluminationMapSpecifier

- (NSDictionary *) oo_emissionAndIlluminationMapSpecifier

Definition at line 69 of file OOMaterialSpecifier.m.

221{
222 if ([self oo_emissionMapSpecifier] != nil || [self oo_illuminationMapSpecifier] != nil) return nil;
223 return [self oo_textureSpecifierForKey:kOOMaterialEmissionAndIlluminationMapName defaultName:nil];
224}

◆ oo_emissionColor

- (OOColor *) oo_emissionColor

Definition at line 69 of file OOMaterialSpecifier.m.

123{
124 OOColor *result = [OOColor colorWithDescription:[self objectForKey:kOOMaterialEmissionColorName]];
125 if (result == nil) result = [OOColor colorWithDescription:[self objectForKey:kOOMaterialEmissionColorLegacyName]];
126
127 if ([result isBlack]) result = nil;
128 return result;
129}

◆ oo_emissionMapSpecifier

- (NSDictionary *) oo_emissionMapSpecifier

Definition at line 69 of file OOMaterialSpecifier.m.

209{
210 return [self oo_textureSpecifierForKey:kOOMaterialEmissionMapName defaultName:nil];
211}

◆ oo_emissionModulateColor

- (OOColor *) oo_emissionModulateColor

Definition at line 69 of file OOMaterialSpecifier.m.

133{
134 OOColor *result = [OOColor colorWithDescription:[self objectForKey:kOOMaterialEmissionModulateColorName]];
135
136 if ([result isWhite]) result = nil;
137 return result;
138}

◆ oo_gammaCorrect

- (BOOL) oo_gammaCorrect

Definition at line 69 of file OOMaterialSpecifier.m.

240{
241 return [self oo_boolForKey:kOOMaterialGammaCorrectName defaultValue:![[NSUserDefaults standardUserDefaults] boolForKey:@"no-gamma-correct"]];
242}

◆ oo_gloss

- (float) oo_gloss

Definition at line 69 of file OOMaterialSpecifier.m.

246{
247 return OOClamp_0_1_f([self oo_floatForKey:kOOMaterialGlossName defaultValue:0.375f]);
248}
NSString *const kOOMaterialGlossName

◆ oo_illuminationMapSpecifier

- (NSDictionary *) oo_illuminationMapSpecifier

Definition at line 69 of file OOMaterialSpecifier.m.

215{
216 return [self oo_textureSpecifierForKey:kOOMaterialIlluminationMapName defaultName:nil];
217}

◆ oo_illuminationModulateColor

- (OOColor *) oo_illuminationModulateColor

Definition at line 69 of file OOMaterialSpecifier.m.

142{
143 OOColor *result = [OOColor colorWithDescription:[self objectForKey:kOOMaterialIlluminationModulateColorName]];
144
145 if ([result isWhite]) result = nil;
146 return result;
147}

◆ oo_normalAndParallaxMapSpecifier

- (NSDictionary *) oo_normalAndParallaxMapSpecifier

Definition at line 69 of file OOMaterialSpecifier.m.

203{
204 return [self oo_textureSpecifierForKey:kOOMaterialNormalAndParallaxMapName defaultName:nil];
205}

◆ oo_normalMapSpecifier

- (NSDictionary *) oo_normalMapSpecifier

Definition at line 69 of file OOMaterialSpecifier.m.

182{
183 if ([self oo_normalAndParallaxMapSpecifier] != nil) return nil;
184 return [self oo_textureSpecifierForKey:kOOMaterialNormalMapName defaultName:nil];
185}

◆ oo_parallaxBias

- (float) oo_parallaxBias

Definition at line 69 of file OOMaterialSpecifier.m.

234{
235 return [self oo_floatForKey:kOOMaterialParallaxBiasName];
236}

◆ oo_parallaxMapSpecifier

- (NSDictionary *) oo_parallaxMapSpecifier

Definition at line 69 of file OOMaterialSpecifier.m.

189{
190 id spec = [self oo_textureSpecifierForKey:kOOMaterialParallaxMapName defaultName:nil];
191 if (spec == nil)
192 {
193 // Default is alpha channel of normal_and_parallax_map.
194 spec = [[self oo_normalAndParallaxMapSpecifier] dictionaryByAddingObject:@"a"
195 forKey:@"extract_channel"];
196 }
197
198 return spec;
199}

◆ oo_parallaxScale

- (float) oo_parallaxScale

Definition at line 69 of file OOMaterialSpecifier.m.

228{
229 return [self oo_floatForKey:kOOMaterialParallaxScaleName defaultValue:kOOMaterialDefaultParallaxScale];
230}

◆ oo_rawSpecularExponentValue

- (int) oo_rawSpecularExponentValue
implementation

Definition at line 69 of file OOMaterialSpecifier.m.

76{
77 NSObject *value = [self objectForKey:kOOMaterialSpecularExponentName];
78 if (value == nil) value = [self objectForKey:kOOMaterialSpecularExponentLegacyName];
79 return OOIntFromObject(value, -1);
80}

◆ oo_specularColor

- (OOColor *) oo_specularColor

Definition at line 69 of file OOMaterialSpecifier.m.

102{
103 OOColor *result = [OOColor colorWithDescription:[self objectForKey:kOOMaterialSpecularColorName]];
104 if (result == nil) result = [OOColor colorWithDescription:[self objectForKey:kOOMaterialSpecularColorLegacyName]];
105 if (result == nil)
106 {
107 result = [OOColor colorWithWhite:0.2f alpha:1.0f];
108 }
109 return result;
110}
OOColor * colorWithWhite:alpha:(float white,[alpha] float alpha)
Definition OOColor.m:103

◆ oo_specularColorMapSpecifier

- (NSDictionary *) oo_specularColorMapSpecifier

Definition at line 69 of file OOMaterialSpecifier.m.

164{
165 if ([self oo_rawSpecularExponentValue] == 0) return nil;
166 NSDictionary *result = [self oo_textureSpecifierForKey:kOOMaterialSpecularColorMapName defaultName:nil];
167 if (result == nil) result = [self oo_combinedSpecularMapSpecifier];
168 return result;
169}

◆ oo_specularExponent

- (int) oo_specularExponent

Definition at line 69 of file OOMaterialSpecifier.m.

252{
253 int result = [self oo_rawSpecularExponentValue];
254 if (result < 0)
255 {
256 if ([UNIVERSE useShaders] && [self oo_specularExponentMapSpecifier] != nil)
257 {
258 result = 128;
259 }
260 else
261 {
262 result = 10;
263 }
264 }
265
266 return result;
267}
#define UNIVERSE
Definition Universe.h:833

◆ oo_specularExponentMapSpecifier

- (NSDictionary *) oo_specularExponentMapSpecifier

Definition at line 69 of file OOMaterialSpecifier.m.

173{
174 if ([self oo_rawSpecularExponentValue] == 0) return nil;
175 NSDictionary *result = [self oo_textureSpecifierForKey:kOOMaterialSpecularExponentMapName defaultName:nil];
176 if (result == nil) result = [[self oo_combinedSpecularMapSpecifier] dictionaryByAddingObject:@"a" forKey:@"extract_channel"];
177 return result;
178}

◆ oo_specularModulateColor

- (OOColor *) oo_specularModulateColor

Definition at line 69 of file OOMaterialSpecifier.m.

114{
115 OOColor *result = [OOColor colorWithDescription:[self objectForKey:kOOMaterialSpecularModulateColorName]];
116 if (result == nil) result = [OOColor whiteColor];
117
118 return result;
119}
OOColor * whiteColor()
Definition OOColor.m:256

The documentation for this category was generated from the following files: