100 :(NSDictionary *)emissionMapSpec
101 emissionColor:(
OOColor *)emissionColor
103 diffuseColor:(
OOColor *)diffuseColor
104 illuminationMapSpec:(NSDictionary *)illuminationMapSpec
105 illuminationColor:(
OOColor *)illuminationColor
106 isCombinedMap:(BOOL)isCombinedMap
107 optionsSpecifier:(NSDictionary *)spec
108{
109 if (emissionMapSpec ==
nil && illuminationMapSpec ==
nil)
110 {
111 [self release];
113 }
114
115 NSParameterAssert(illuminationMapSpec ==
nil || !isCombinedMap);
116
117 uint32_t options;
118 GLfloat anisotropy;
119 GLfloat lodBias;
122
123 if ((self = [super initWithPath:@"<generated emission map>" options:options]))
124 {
125
126
127
128
129
130 illuminationColor =
ModulateColor(diffuseColor, illuminationColor);
131
132 if ([emissionColor isWhite]) emissionColor =
nil;
133 if ([illuminationColor isWhite]) illuminationColor =
nil;
134 if (!isCombinedMap && illuminationMapSpec ==
nil) diffuseMap =
nil;
135
136
137 NSMutableDictionary *emissionSpec = [emissionMapSpec mutableCopy];
138 [emissionSpec oo_setBool:YES forKey:kOOTextureSpecifierExtraShrinkKey];
139 _emissionSpec = emissionSpec;
140
141 NSMutableDictionary *illuminationSpec = [illuminationMapSpec mutableCopy];
142 [illuminationSpec oo_setBool:YES forKey:kOOTextureSpecifierExtraShrinkKey];
143 _illuminationSpec = illuminationSpec;
144
145 _diffuseMap = [diffuseMap
retain];
146
147 _emissionColor = [emissionColor retain];
148 _illuminationColor = [illuminationColor retain];
149 _isCombinedMap = isCombinedMap;
150
151 _textureOptions = options;
152 _anisotropy = anisotropy;
153 _lodBias = lodBias;
154
155 _cacheKey = [self constructCacheKey];
156
158 {
159
160
161
162
163 if (diffuseMap !=
nil)
164 {
166#ifndef NDEBUG
167 _diffuseDesc = [[diffuseMap shortDescription] copy];
168#endif
169 }
170
171
172
173
174
176 if (_emissionSpec !=
nil)
177 {
182#ifndef NDEBUG
183 _emissionDesc = [[emissionMapLoader shortDescription] copy];
184#endif
185 }
186 if (_illuminationSpec !=
nil)
187 {
192#ifndef NDEBUG
193 _illuminationDesc = [[illuminationMapLoader shortDescription] copy];
194#endif
195 }
196 }
197 }
198
199 return self;
200}
static OOColor * ModulateColor(OOColor *a, OOColor *b)
OOTextureFlags OOApplyTextureOptionDefaults(OOTextureFlags options)
BOOL OOInterpretTextureSpecifier(id specifier, NSString **outName, OOTextureFlags *outOptions, float *outAnisotropy, float *outLODBias, BOOL ignoreExtract)
id loaderWithTextureSpecifier:extraOptions:folder:(id specifier,[extraOptions] uint32_t extraOptions,[folder] NSString *folder)
BOOL getResult:format:originalWidth:originalHeight:(OOPixMap *result,[format] OOTextureDataFormat *outFormat,[originalWidth] uint32_t *outWidth,[originalHeight] uint32_t *outHeight)
OOPixMap copyPixMapRepresentation()