Oolite
Loading...
Searching...
No Matches
OOMaterialConvenienceCreators.m
Go to the documentation of this file.
1/*
2
3OOMaterialConvenienceCreators.m
4
5
6Copyright (C) 2007-2013 Jens Ayton
7
8Permission is hereby granted, free of charge, to any person obtaining a copy
9of this software and associated documentation files (the "Software"), to deal
10in the Software without restriction, including without limitation the rights
11to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12copies of the Software, and to permit persons to whom the Software is
13furnished to do so, subject to the following conditions:
14
15The above copyright notice and this permission notice shall be included in all
16copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24SOFTWARE.
25
26*/
27
28#ifndef USE_NEW_SHADER_SYNTHESIZER
29#define USE_NEW_SHADER_SYNTHESIZER 0
30#endif
31
34
35#if USE_NEW_SHADER_SYNTHESIZER
37#import "ResourceManager.h"
38#endif
39
40#import "OOCacheManager.h"
42#import "OODebugFlags.h"
45#import "OOShaderMaterial.h"
47#import "OOTexture.h"
48#import "Universe.h"
49
50#if !USE_NEW_SHADER_SYNTHESIZER
51typedef struct
52{
53 NSDictionary* inConfig;
54 NSMutableDictionary* outConfig;
55 NSUInteger texturesUsed;
56 NSUInteger maxTextures;
57
58 NSMutableDictionary* macros;
59 NSMutableArray* textures;
60 NSMutableDictionary* uniforms;
62
63static void SetUniform(NSMutableDictionary* uniforms, NSString* key, NSString* type, id value);
64static void SetUniformFloat(OOMaterialSynthContext* context, NSString* key, float value);
65
66/* AddTexture(): add a texture to the configuration being synthesized.
67 * specifier is added to the textures array.
68 * uniformName is mapped to the appropriate texture unit in the uniforms dictionary.
69 * If nonShaderKey is not nil, nonShaderKey (e.g. diffuse_map) is set to specifier.
70 * If macroName is not nil, macroName is set to 1 in the macros dictionary.
71 */
72static void AddTexture(OOMaterialSynthContext* context, NSString* uniformName, NSString* nonShaderKey, NSString* macroName, NSDictionary* specifier);
73
74static void AddColorIfAppropriate(OOMaterialSynthContext* context, SEL selector, NSString* key, NSString* macroName);
75static void AddMacroColorIfAppropriate(OOMaterialSynthContext* context, SEL selector, NSString* macroName);
76
77static void SynthDiffuse(OOMaterialSynthContext* context, NSString* name);
79static void SynthNormalMap(OOMaterialSynthContext* context);
80static void SynthSpecular(OOMaterialSynthContext* context);
81
82#endif
83
84@implementation OOMaterial (OOConvenienceCreators)
85
86#if !USE_NEW_SHADER_SYNTHESIZER
87
88+ (NSDictionary*)synthesizeMaterialDictionaryWithName:(NSString*)name
89 configuration:(NSDictionary*)configuration
90 macros:(NSDictionary*)macros
91{
92 if (configuration == nil)
93 configuration = [NSDictionary dictionary];
94 OOMaterialSynthContext context = {
95 .inConfig = configuration,
96 .outConfig = [NSMutableDictionary dictionary],
98
99 .macros = [NSMutableDictionary dictionaryWithDictionary:macros],
100 .textures = [NSMutableArray array],
101 .uniforms = [NSMutableDictionary dictionary]
102 };
103
104 if ([UNIVERSE reducedDetail]) {
105 context.maxTextures = 3;
106 }
107
108 // Basic stuff.
109
110 /* Set up the various material attributes.
111 Order is significant here, because it determines the order in which
112 features will be dropped if we exceed the hardware's texture image
113 unit limit.
114 */
115 SynthDiffuse(&context, name);
117 SynthNormalMap(&context);
118 SynthSpecular(&context);
119
120 if ([UNIVERSE detailLevel] >= DETAIL_LEVEL_SHADERS) {
121 // Add uniforms required for hull heat glow.
122 [context.uniforms setObject:@"hullHeatLevel" forKey:@"uHullHeatLevel"];
123 [context.uniforms setObject:@"timeElapsedSinceSpawn" forKey:@"uTime"];
124 [context.uniforms setObject:@"fogUniform" forKey:@"uFogColor"];
125 }
126
127 // Stuff in the general properties.
128 [context.outConfig setObject:@"true" forKey:@"_oo_is_synthesized_config"];
129 [context.outConfig setObject:@"oolite-tangent-space-vertex.vertex" forKey:@"vertex_shader"];
130 [context.outConfig setObject:@"oolite-default-shader.fragment" forKey:@"fragment_shader"];
131
132 if ([context.textures count] != 0)
133 [context.outConfig setObject:context.textures forKey:@"textures"];
134 if ([context.uniforms count] != 0)
135 [context.outConfig setObject:context.uniforms forKey:@"uniforms"];
136 if ([context.macros count] != 0)
137 [context.outConfig setObject:context.macros forKey:@"_oo_synthesized_material_macros"];
138
139 return context.outConfig;
140}
141
142+ (OOMaterial*)defaultShaderMaterialWithName:(NSString*)name
143 cacheKey:(NSString*)cacheKey
144 configuration:(NSDictionary*)configuration
145 macros:(NSDictionary*)macros
146 bindingTarget:(id<OOWeakReferenceSupport>)target
147{
148 OOCacheManager* cache = nil;
149 NSDictionary* synthesizedConfig = nil;
150 OOMaterial* result = nil;
151
152 // Avoid looping (can happen if shader fails to compile).
153 if ([configuration objectForKey:@"_oo_is_synthesized_config"] != nil) {
154 OOLog(@"material.synthesize.loop", @"Synthesis loop for material %@.", name);
155 return nil;
156 }
157
158 if (cacheKey != nil) {
159 cache = [OOCacheManager sharedCache];
160 // configuration must be in cache key, as otherwise changes in
161 // non-diffuse map can end up miscached
162 cacheKey = [NSString stringWithFormat:@"%@/%@/%@", cacheKey, name, configuration];
163 synthesizedConfig = [cache objectForKey:cacheKey inCache:@"synthesized shader materials"];
164 }
165
166 if (synthesizedConfig == nil) {
167 synthesizedConfig = [self synthesizeMaterialDictionaryWithName:name
168 configuration:configuration
169 macros:macros];
170 if (synthesizedConfig != nil && cacheKey != nil) {
171 [cache setObject:synthesizedConfig
172 forKey:cacheKey
173 inCache:@"synthesized shader materials"];
174 }
175 }
176
177 if (synthesizedConfig != nil) {
178 result = [self materialWithName:name
179 cacheKey:cacheKey
180 configuration:synthesizedConfig
181 macros:[synthesizedConfig objectForKey:@"_oo_synthesized_material_macros"]
182 bindingTarget:target
183 forSmoothedMesh:YES];
184 }
185
186 return result;
187}
188
189#else
190
191#ifndef NDEBUG
192static BOOL sDumpShaderSource = NO;
193
194+ (void)initialize
195{
196 sDumpShaderSource = [[NSUserDefaults standardUserDefaults] boolForKey:@"dump-synthesized-shaders"];
197}
198#endif
199
200+ (OOMaterial*)defaultShaderMaterialWithName:(NSString*)name
201 cacheKey:(NSString*)cacheKey
202 configuration:(NSDictionary*)configuration
203 macros:(NSDictionary*)macros
204 bindingTarget:(id<OOWeakReferenceSupport>)target
205{
206 NSString* vertexShader = nil;
207 NSString* fragmentShader = nil;
208 NSArray* textureSpecs = nil;
209 NSDictionary* uniformSpecs = nil;
210
211 if (!OOSynthesizeMaterialShader(configuration, name, cacheKey /* FIXME: entity name for error reporting */, &vertexShader, &fragmentShader, &textureSpecs, &uniformSpecs)) {
212 return nil;
213 }
214
215 NSDictionary* synthesizedConfig = [NSDictionary dictionaryWithObjectsAndKeys:
216 [NSNumber numberWithBool:YES], kOOIsSynthesizedMaterialConfigurationKey,
217 textureSpecs, kOOTexturesKey,
218 uniformSpecs, kOOUniformsKey,
219 vertexShader, kOOVertexShaderSourceKey,
220 fragmentShader, kOOFragmentShaderSourceKey,
221 nil];
222
223#ifndef NDEBUG
224 if (sDumpShaderSource) {
225 NSString* dumpPath = [NSString stringWithFormat:@"Synthesized Materials/%@/%@", cacheKey, name];
226
227 [ResourceManager writeDiagnosticString:vertexShader toFileNamed:[dumpPath stringByAppendingPathExtension:@"vertex"]];
228 [ResourceManager writeDiagnosticString:fragmentShader toFileNamed:[dumpPath stringByAppendingPathExtension:@"fragment"]];
229
230 // Hide internal keys in the synthesized config before writing it.
231 NSMutableDictionary* humanFriendlyConfig = [[synthesizedConfig mutableCopy] autorelease];
232 [humanFriendlyConfig removeObjectForKey:kOOVertexShaderSourceKey];
233 [humanFriendlyConfig removeObjectForKey:kOOFragmentShaderSourceKey];
234 [humanFriendlyConfig removeObjectForKey:kOOIsSynthesizedMaterialConfigurationKey];
235 [humanFriendlyConfig setObject:[NSString stringWithFormat:@"%@.vertex", name] forKey:kOOVertexShaderNameKey];
236 [humanFriendlyConfig setObject:[NSString stringWithFormat:@"%@.fragment", name] forKey:kOOFragmentShaderNameKey];
237
238 [ResourceManager writeDiagnosticPList:humanFriendlyConfig toFileNamed:[dumpPath stringByAppendingPathExtension:@"plist"]];
239
240 [ResourceManager writeDiagnosticPList:configuration toFileNamed:[[dumpPath stringByAppendingString:@"-original"] stringByAppendingPathExtension:@"plist"]];
241 }
242#endif
243
244 return [self materialWithName:name
245 cacheKey:cacheKey
246 configuration:synthesizedConfig
247 macros:nil
248 bindingTarget:target
249 forSmoothedMesh:YES];
250}
251
252#endif
253
254+ (OOMaterial*)materialWithName:(NSString*)name
255 cacheKey:(NSString*)cacheKey
256 configuration:(NSDictionary*)configuration
257 macros:(NSDictionary*)macros
258 bindingTarget:(id<OOWeakReferenceSupport>)object
259 forSmoothedMesh:(BOOL)smooth // Internally, this flg really means "force use of shaders".
260{
261 id result = nil;
262
263#if OO_SHADERS
264
265 if ([UNIVERSE useShaders]) {
266 if ([OOShaderMaterial configurationDictionarySpecifiesShaderMaterial:configuration]) {
267 result = [OOShaderMaterial shaderMaterialWithName:name
268 configuration:configuration
269 macros:macros
270 bindingTarget:object];
271 }
272
273 // Use default shader if smoothing is on, or shader detail is full, DEBUG_NO_SHADER_FALLBACK is set, or material uses an effect map.
274 if (result == nil && (smooth || gDebugFlags & DEBUG_NO_SHADER_FALLBACK || [UNIVERSE detailLevel] >= DETAIL_LEVEL_SHADERS || [configuration oo_combinedSpecularMapSpecifier] != nil || [configuration oo_normalMapSpecifier] != nil || [configuration oo_parallaxMapSpecifier] != nil || [configuration oo_normalAndParallaxMapSpecifier] != nil || [configuration oo_emissionMapSpecifier] != nil || [configuration oo_illuminationMapSpecifier] != nil || [configuration oo_emissionAndIlluminationMapSpecifier] != nil)) {
275 result = [self defaultShaderMaterialWithName:name
276 cacheKey:cacheKey
277 configuration:configuration
278 macros:macros
279 bindingTarget:(id<OOWeakReferenceSupport>)object];
280 }
281 }
282#endif
283
284#if OO_MULTITEXTURE
285 if (result == nil /*&& ![UNIVERSE reducedDetail]*/) {
286 if ([configuration oo_emissionMapSpecifier] != nil ||
287 [configuration oo_illuminationMapSpecifier] ||
288 [configuration oo_emissionAndIlluminationMapSpecifier] != nil) {
289 result = [[OOMultiTextureMaterial alloc] initWithName:name configuration:configuration];
290 [result autorelease];
291 }
292 }
293#endif
294
295 if (result == nil) {
296 if ([configuration oo_diffuseMapSpecifierWithDefaultName:name] == nil) {
297 result = [[OOBasicMaterial alloc] initWithName:name configuration:configuration];
298 } else {
299 result = [[OOSingleTextureMaterial alloc] initWithName:name configuration:configuration];
300 }
301 if (result == nil) {
302 result = [[OOBasicMaterial alloc] initWithName:name configuration:configuration];
303 }
304 [result autorelease];
305 }
306 return result;
307}
308
309+ (OOMaterial*)materialWithName:(NSString*)name
310 cacheKey:(NSString*)cacheKey
311 materialDictionary:(NSDictionary*)materialDict
312 shadersDictionary:(NSDictionary*)shadersDict
313 macros:(NSDictionary*)macros
314 bindingTarget:(id<OOWeakReferenceSupport>)object
315 forSmoothedMesh:(BOOL)smooth
316{
317 NSDictionary* configuration = nil;
318
319#if OO_SHADERS
320
321 if ([UNIVERSE useShaders]) {
322 configuration = [shadersDict oo_dictionaryForKey:name];
323 }
324#endif
325
326 if (configuration == nil) {
327 configuration = [materialDict oo_dictionaryForKey:name];
328 }
329
330 if (configuration == nil) {
331 // Use fallback material for non-existent simple texture.
332 // Texture caching means this won't be wasted in the general case.
333 OOTexture* texture = [OOTexture textureWithName:name inFolder:@"Textures"];
334 if (texture == nil)
335 return nil;
336
337 configuration = [NSDictionary dictionary];
338 }
339
340 return [self materialWithName:name
341 cacheKey:cacheKey
342 configuration:configuration
343 macros:macros
344 bindingTarget:object
345 forSmoothedMesh:smooth];
346}
347
348@end
349
350#if !USE_NEW_SHADER_SYNTHESIZER
351
352static void SetUniform(NSMutableDictionary* uniforms, NSString* key, NSString* type, id value)
353{
354 [uniforms setObject:[NSDictionary dictionaryWithObjectsAndKeys:type, @"type", value, @"value", nil] forKey:key];
355}
356
357static void SetUniformFloat(OOMaterialSynthContext* context, NSString* key, float value)
358{
359 SetUniform(context->uniforms, key, @"float", [NSNumber numberWithFloat:value]);
360}
361
362static void AddTexture(OOMaterialSynthContext* context, NSString* uniformName, NSString* nonShaderKey, NSString* macroName, NSDictionary* specifier)
363{
364 NSCParameterAssert(context->texturesUsed < context->maxTextures);
365
366 context->texturesUsed++;
367 SetUniform(context->uniforms, uniformName, @"texture", [NSNumber numberWithUnsignedInteger:[context->textures count]]);
368 [context->textures addObject:specifier];
369 if (nonShaderKey != nil) {
370 [context->outConfig setObject:specifier forKey:kOOMaterialDiffuseMapName];
371 }
372 if (macroName != nil) {
373 [context->macros setObject:@"1" forKey:macroName];
374 }
375}
376
377static void AddColorIfAppropriate(OOMaterialSynthContext* context, SEL selector, NSString* key, NSString* macroName)
378{
379 OOColor* color = [context->inConfig performSelector:selector];
380
381 if (color != nil) {
382 [context->outConfig setObject:[color normalizedArray] forKey:key];
383 if (macroName != nil)
384 [context->macros setObject:@"1" forKey:macroName];
385 }
386}
387
388static void AddMacroColorIfAppropriate(OOMaterialSynthContext* context, SEL selector, NSString* macroName)
389{
390 OOColor* color = [context->inConfig performSelector:selector];
391
392 if (color != nil) {
393 NSString* macroText = [NSString stringWithFormat:@"vec4(%g, %g, %g, %g)",
394 [color redComponent],
395 [color greenComponent],
396 [color blueComponent],
397 [color alphaComponent]];
398 [context->macros setObject:macroText forKey:macroName];
399 }
400}
401
402static void SynthDiffuse(OOMaterialSynthContext* context, NSString* name)
403{
404 // Set up diffuse map if appropriate.
405 NSDictionary* diffuseMapSpec = [context->inConfig oo_diffuseMapSpecifierWithDefaultName:name];
406 if (diffuseMapSpec != nil && context->texturesUsed < context->maxTextures) {
407 AddTexture(context, @"uDiffuseMap", kOOMaterialDiffuseMapName, @"OOSTD_DIFFUSE_MAP", diffuseMapSpec);
408
409 if ([diffuseMapSpec oo_boolForKey:@"cube_map"]) {
410 [context->macros setObject:@"1" forKey:@"OOSTD_DIFFUSE_MAP_IS_CUBE_MAP"];
411 }
412 } else {
413 // No diffuse map must be specified explicitly.
414 [context->outConfig setObject:@"" forKey:kOOMaterialDiffuseMapName];
415 }
416
417 // Set up diffuse colour if any.
418 AddColorIfAppropriate(context, @selector(oo_diffuseColor), kOOMaterialDiffuseColorName, nil);
419}
420
422{
423 // Read the various emission and illumination textures, and decide what to do with them.
424 NSDictionary* emissionMapSpec = [context->inConfig oo_emissionMapSpecifier];
425 NSDictionary* illuminationMapSpec = [context->inConfig oo_illuminationMapSpecifier];
426 NSDictionary* emissionAndIlluminationSpec = [context->inConfig oo_emissionAndIlluminationMapSpecifier];
427 BOOL isCombinedSpec = NO;
428 BOOL haveIlluminationMap = NO;
429
430 if (emissionMapSpec == nil && emissionAndIlluminationSpec != nil) {
431 emissionMapSpec = emissionAndIlluminationSpec;
432 if (illuminationMapSpec == nil)
433 isCombinedSpec = YES; // Else use only emission part of emission_and_illumination_map, combined with full illumination_map.
434 }
435
436 if (emissionMapSpec != nil && context->texturesUsed < context->maxTextures) {
437 /* FIXME: at this point, if there is an illumination map, we should
438 consider merging it into the emission map using
439 OOCombinedEmissionMapGenerator if the total number of texture
440 specifiers is greater than context->maxTextures. This will
441 require adding a new type of texture specifier - not a big deal.
442 -- Ahruman 2010-05-21
443 */
444 AddTexture(context, @"uEmissionMap", nil, isCombinedSpec ? @"OOSTD_EMISSION_AND_ILLUMINATION_MAP" : @"OOSTD_EMISSION_MAP", emissionMapSpec);
445 /* Note that this sets emission_color, not emission_modulate_color.
446 This is because the emission colour value is sent through the
447 standard OpenGL emission colour attribute by OOBasicMaterial.
448 */
449 AddColorIfAppropriate(context, @selector(oo_emissionModulateColor), kOOMaterialEmissionColorName, @"OOSTD_EMISSION");
450
451 haveIlluminationMap = isCombinedSpec;
452 } else {
453 // No emission map, use overall emission colour if specified.
454 AddColorIfAppropriate(context, @selector(oo_emissionColor), kOOMaterialEmissionColorName, @"OOSTD_EMISSION");
455 }
456
457 if (illuminationMapSpec != nil && context->texturesUsed < context->maxTextures) {
458 AddTexture(context, @"uIlluminationMap", nil, @"OOSTD_ILLUMINATION_MAP", illuminationMapSpec);
459 haveIlluminationMap = YES;
460 }
461
462 if (haveIlluminationMap) {
463 AddMacroColorIfAppropriate(context, @selector(oo_illuminationModulateColor), @"OOSTD_ILLUMINATION_COLOR");
464 }
465}
466
468{
469 if (context->texturesUsed < context->maxTextures) {
470 BOOL hasParallax = YES;
471 NSDictionary* normalMapSpec = [context->inConfig oo_normalAndParallaxMapSpecifier];
472 if (normalMapSpec == nil) {
473 hasParallax = NO;
474 normalMapSpec = [context->inConfig oo_normalMapSpecifier];
475 }
476
477 if (normalMapSpec != nil) {
478 AddTexture(context, @"uNormalMap", nil, @"OOSTD_NORMAL_MAP", normalMapSpec);
479
480 if (hasParallax) {
481 [context->macros setObject:@"1" forKey:@"OOSTD_NORMAL_AND_PARALLAX_MAP"];
482 SetUniformFloat(context, @"uParallaxScale", [context->inConfig oo_parallaxScale]);
483 SetUniformFloat(context, @"uParallaxBias", [context->inConfig oo_parallaxBias]);
484 }
485 }
486 }
487}
488
490{
491 GLint shininess = [context->inConfig oo_specularExponent];
492 if (shininess <= 0)
493 return;
494
495 GLfloat gloss = [context->inConfig oo_gloss];
496 if (gloss < 0.0f || gloss > 1.0f)
497 return;
498
499 BOOL gammaCorrect = [context->inConfig oo_gammaCorrect];
500
501 NSDictionary* specularMapSpec = nil;
502 OOColor* specularColor = nil;
503
504 if (context->texturesUsed < context->maxTextures) {
505 specularMapSpec = [context->inConfig oo_combinedSpecularMapSpecifier];
506 }
507
508 if (specularMapSpec != nil)
509 specularColor = [context->inConfig oo_specularModulateColor];
510 else
511 specularColor = [context->inConfig oo_specularColor];
512 if ([specularColor isBlack])
513 return;
514
515 SetUniformFloat(context, @"uGloss", gloss);
516
517 [context->outConfig setObject:[NSNumber numberWithUnsignedInt:shininess] forKey:kOOMaterialSpecularExponentLegacyName];
518
519 if (specularMapSpec != nil) {
520 AddTexture(context, @"uSpecularMap", kOOMaterialDiffuseMapName, @"OOSTD_SPECULAR_MAP", specularMapSpec);
521 }
522
523 if (specularColor != nil) {
524 /* As with emission colour, specular_modulate_color is transformed to
525 specular_color here because the shader reads it from the standard
526 material specular colour property set by OOBasicMaterial.
527 */
528 [context->outConfig setObject:[specularColor normalizedArray] forKey:kOOMaterialSpecularColorName];
529 }
530 [context->macros setObject:@"1" forKey:@"OOSTD_SPECULAR"];
531
532 // setting a bool as a float uniform, to be used in the shader as a bool again
533 // this is how hackish I can get... maybe a better way exists, but this is quick
534 // and can be used also for the shader materials in a not too different way
535 // - Nikos 20181001
536 SetUniformFloat(context, @"uGammaCorrect", (float)gammaCorrect);
537}
538
539#endif
#define gDebugFlags
@ DEBUG_NO_SHADER_FALLBACK
BOOL OOSynthesizeMaterialShader(NSDictionary *materialConfiguration, NSString *materialKey, NSString *entityName, NSString **outVertexShader, NSString **outFragmentShader, NSArray **outTextureSpecs, NSDictionary **outUniformSpecs)
#define OOLog(class, format,...)
Definition OOLogging.h:84
static void AddMacroColorIfAppropriate(OOMaterialSynthContext *context, SEL selector, NSString *macroName)
static void SynthDiffuse(OOMaterialSynthContext *context, NSString *name)
static void AddColorIfAppropriate(OOMaterialSynthContext *context, SEL selector, NSString *key, NSString *macroName)
static void SetUniform(NSMutableDictionary *uniforms, NSString *key, NSString *type, id value)
static void AddTexture(OOMaterialSynthContext *context, NSString *uniformName, NSString *nonShaderKey, NSString *macroName, NSDictionary *specifier)
static void SynthSpecular(OOMaterialSynthContext *context)
static void SynthNormalMap(OOMaterialSynthContext *context)
static void SynthEmissionAndIllumination(OOMaterialSynthContext *context)
static void SetUniformFloat(OOMaterialSynthContext *context, NSString *key, float value)
NSString *const kOOMaterialDiffuseColorName
NSString *const kOOMaterialEmissionColorName
NSString *const kOOMaterialDiffuseMapName
unsigned count
return nil
@ DETAIL_LEVEL_SHADERS
Definition OOTypes.h:211
#define UNIVERSE
Definition Universe.h:827
void setObject:forKey:inCache:(id inElement,[forKey] NSString *inKey,[inCache] NSString *inCacheKey)
id objectForKey:inCache:(NSString *inKey,[inCache] NSString *inCacheKey)
OOCacheManager * sharedCache()
float alphaComponent()
Definition OOColor.m:442
float blueComponent()
Definition OOColor.m:339
NSArray * normalizedArray()
Definition OOColor.m:465
float redComponent()
Definition OOColor.m:329
float greenComponent()
Definition OOColor.m:334
OOMaterial * defaultShaderMaterialWithName:cacheKey:configuration:macros:bindingTarget:(NSString *name, [cacheKey] NSString *cacheKey, [configuration] NSDictionary *configuration, [macros] NSDictionary *macros, [bindingTarget] id< OOWeakReferenceSupport > target)
NSDictionary * synthesizeMaterialDictionaryWithName:configuration:macros:(NSString *name, [configuration] NSDictionary *configuration, [macros] NSDictionary *macros)
OOMaterial * materialWithName:cacheKey:configuration:macros:bindingTarget:forSmoothedMesh:(NSString *name,[cacheKey] NSString *cacheKey,[configuration] NSDictionary *configuration,[macros] NSDictionary *macros,[bindingTarget] id< OOWeakReferenceSupport > object,[forSmoothedMesh] BOOL smooth)
OOOpenGLExtensionManager * sharedManager()
id textureWithName:inFolder:(NSString *name,[inFolder] NSString *directory)
Definition OOTexture.m:176
BOOL writeDiagnosticPList:toFileNamed:(id plist,[toFileNamed] NSString *name)
BOOL writeDiagnosticString:toFileNamed:(NSString *string,[toFileNamed] NSString *name)