Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OODefaultShaderSynthesizer Class Reference
+ Inheritance diagram for OODefaultShaderSynthesizer:
+ Collaboration diagram for OODefaultShaderSynthesizer:

Instance Methods

(id) - initWithMaterialConfiguration:materialKey:entityName:
 
(BOOL) - run
 
(NSString *) - vertexShader
 
(NSString *) - fragmentShader
 
(NSArray *) - textureSpecifications
 
(NSDictionary *) - uniformSpecifications
 
(NSString *) - materialKey
 
(NSString *) - entityName
 
(void) - createTemporaries
 
(void) - destroyTemporaries
 
(void) - composeVertexShader
 
(void) - composeFragmentShader
 
(void) - appendVariable:ofType:withPrefix:to:
 
(void) - addAttribute:ofType:
 
(void) - addVarying:ofType:
 
(void) - addVertexUniform:ofType:
 
(void) - addFragmentUniform:ofType:
 
(NSString *) - defineBindingUniform:ofType:
 
(NSString *) - readRGBForTextureSpec:mapName:
 
(NSString *) - readOneChannelForTextureSpec:mapName:
 
(NSUInteger) - textureIDForSpec:
 
(void) - setUpOneTexture:
 
(void) - getSampleName:andSwizzleOp:forTextureSpec:
 
(void) - writeTextureCoordRead
 
(void) - writeDiffuseColorTermIfNeeded
 
(void) - writeDiffuseColorTerm
 
(void) - writeDiffuseLighting
 
(void) - writeLightVector
 
(void) - writeEyeVector
 
(void) - writeVertexTangentBasis
 
(void) - writeNormalIfNeeded
 
(void) - writeNormal
 
(void) - writeSpecularLighting
 
(void) - writeLightMaps
 
(void) - writeVertexPosition
 
(void) - writeTotalColor
 
(void) - writeFinalColorComposite
 
(void) - performStage:
 
(void) - dealloc [implementation]
 
(NSUInteger) - assignIDForTexture: [implementation]
 

Class Methods

(static void) + AppendIfNotEmpty [implementation]
 
(static NSString *) + GetExtractMode [implementation]
 
(static NSString *) + KeyFromTextureParameters [implementation]
 
(static NSString *) + KeyFromTextureSpec [implementation]
 

Private Attributes

NSDictionary * _configuration
 
NSString * _materialKey
 
NSString * _entityName
 
NSString * _vertexShader
 
NSString * _fragmentShader
 
NSMutableArray * _textures
 
NSMutableDictionary * _uniforms
 
NSMutableString * _attributes
 
NSMutableString * _varyings
 
NSMutableString * _vertexUniforms
 
NSMutableString * _fragmentUniforms
 
NSMutableString * _vertexHelpers
 
NSMutableString * _fragmentHelpers
 
NSMutableString * _vertexBody
 
NSMutableString * _fragmentPreTextures
 
NSMutableString * _fragmentTextureLookups
 
NSMutableString * _fragmentBody
 
NSMutableDictionary * _texturesByName
 
NSMutableDictionary * _textureIDs
 
NSHashTable * _sampledTextures
 
NSMutableDictionary * _uniformBindingNames
 
NSUInteger _usesNormalMap: 1
 
NSUInteger _usesDiffuseTerm: 1
 
NSUInteger _constZNormal: 1
 
NSUInteger _haveDiffuseLight: 1
 
NSUInteger _completed_writeFinalColorComposite: 1
 
NSUInteger _completed_writeDiffuseColorTerm: 1
 
NSUInteger _completed_writeSpecularLighting: 1
 
NSUInteger _completed_writeLightMaps: 1
 
NSUInteger _completed_writeDiffuseLighting: 1
 
NSUInteger _completed_writeDiffuseColorTermIfNeeded: 1
 
NSUInteger _completed_writeVertexPosition: 1
 
NSUInteger _completed_writeNormalIfNeeded: 1
 
NSUInteger _completed_writeLightVector: 1
 
NSUInteger _completed_writeEyeVector: 1
 
NSUInteger _completed_writeTotalColor: 1
 
NSUInteger _completed_writeTextureCoordRead: 1
 
NSUInteger _completed_writeVertexTangentBasis: 1
 
NSHashTable * _stagesInProgress
 

Detailed Description

Definition at line 56 of file OODefaultShaderSynthesizer.m.

Method Documentation

◆ addAttribute:ofType:

- (void) addAttribute: (NSString *) name
ofType: (NSString *) type 

Definition at line 418 of file OODefaultShaderSynthesizer.m.

453 :(NSString *)name ofType:(NSString *)type
454{
455 [self appendVariable:name ofType:type withPrefix:@"attribute" to:_attributes];
456}

References nil.

◆ addFragmentUniform:ofType:

- (void) addFragmentUniform: (NSString *) name
ofType: (NSString *) type 

Definition at line 418 of file OODefaultShaderSynthesizer.m.

471 :(NSString *)name ofType:(NSString *)type
472{
473 [self appendVariable:name ofType:type withPrefix:@"uniform" to:_fragmentUniforms];
474}

◆ addVarying:ofType:

- (void) addVarying: (NSString *) name
ofType: (NSString *) type 

Definition at line 418 of file OODefaultShaderSynthesizer.m.

459 :(NSString *)name ofType:(NSString *)type
460{
461 [self appendVariable:name ofType:type withPrefix:@"varying" to:_varyings];
462}

◆ addVertexUniform:ofType:

- (void) addVertexUniform: (NSString *) name
ofType: (NSString *) type 

Definition at line 418 of file OODefaultShaderSynthesizer.m.

465 :(NSString *)name ofType:(NSString *)type
466{
467 [self appendVariable:name ofType:type withPrefix:@"uniform" to:_vertexUniforms];
468}

◆ AppendIfNotEmpty

+ (static void) AppendIfNotEmpty (NSMutableString *) buffer
(NSString *) segment
(NSString *) name 
implementation

Definition at line 407 of file OODefaultShaderSynthesizer.m.

408{
409 if ([segment length] > 0)
410 {
411 if ([buffer length] > 0) [buffer appendString:@"\n\n"];
412 if ([name length] > 0) [buffer appendFormat:@"// %@\n", name];
413 [buffer appendString:segment];
414 }
415}

◆ appendVariable:ofType:withPrefix:to:

- (void) appendVariable: (NSString *) name
ofType: (NSString *) type
withPrefix: (NSString *) prefix
to: (NSMutableString *) buffer 

Definition at line 418 of file OODefaultShaderSynthesizer.m.

445 :(NSString *)name ofType:(NSString *)type withPrefix:(NSString *)prefix to:(NSMutableString *)buffer
446{
447 NSUInteger typeDeclLength = [prefix length] + [type length] + 1;
448 NSUInteger padding = (typeDeclLength < 20) ? (23 - typeDeclLength) / 4 : 1;
449 [buffer appendFormat:@"%@ %@%@%@;\n", prefix, type, OOTabString(padding), name];
450}

◆ assignIDForTexture:

- (NSUInteger) assignIDForTexture: (NSDictionary *) spec
implementation

Definition at line 580 of file OODefaultShaderSynthesizer.m.

595 :(NSDictionary *)spec
596{
597 NSParameterAssert(spec != nil);
598
599 // extract_channel doesn't affect uniqueness, and we don't want OOTexture to do actual extraction.
600 if ([spec objectForKey:kOOTextureSpecifierSwizzleKey] != nil)
601 {
602 spec = [spec dictionaryByRemovingObjectForKey:kOOTextureSpecifierSwizzleKey];
603 }
604
605 NSString *texName = nil;
606 OOTextureFlags texOptions;
607 float anisotropy, lodBias;
608 if (!OOInterpretTextureSpecifier(spec, &texName, &texOptions, &anisotropy, &lodBias, YES))
609 {
610 // OOInterpretTextureSpecifier() will have logged something.
611 [NSException raise:NSGenericException format:@"Invalid texture specifier"];
612 }
613
614 if (texOptions & kOOTextureAllowCubeMap)
615 {
616 // cube_map = true; fail regardless of whether actual texture qualifies.
617 OOLogERR(@"material.synthesis.error.cubeMap", @"The material \"%@\" of \"%@\" specifies a cube map texture, but doesn't have custom shaders. Cube map textures are not supported with the default shaders.", [self materialKey], [self entityName]);
618 [NSException raise:NSGenericException format:@"Invalid material"];
619 }
620
621 NSString *key = KeyFromTextureParameters(texName, texOptions, anisotropy, lodBias);
622 NSUInteger texID;
623 NSObject *existing = [_texturesByName objectForKey:key];
624 if (existing == nil)
625 {
626 texID = [_texturesByName count];
627 NSNumber *texIDObj = [NSNumber numberWithUnsignedInteger:texID];
628 NSString *texUniform = [NSString stringWithFormat:@"uTexture%lu", texID];
629
630#ifndef NDEBUG
631 BOOL useInternalFormat = NO;
632#else
633 BOOL useInternalFormat = YES;
634#endif
635
636 [_textures addObject:OOMakeTextureSpecifier(texName, texOptions, anisotropy, lodBias, useInternalFormat)];
637 [_texturesByName setObject:spec forKey:key];
638 [_textureIDs setObject:texIDObj forKey:key];
639 [_uniforms setObject:[NSDictionary dictionaryWithObjectsAndKeys:@"texture", @"type", texIDObj, @"value", nil]
640 forKey:texUniform];
641
642 [self addFragmentUniform:texUniform ofType:@"sampler2D"];
643 }
644 else
645 {
646 texID = [_textureIDs oo_unsignedIntegerForKey:texName];
647 }
648
649 return texID;
650}
#define OOLogERR(class, format,...)
Definition OOLogging.h:112
return nil
@ kOOTextureAllowCubeMap
Definition OOTexture.h:61
uint32_t OOTextureFlags
Definition OOTexture.h:98
BOOL OOInterpretTextureSpecifier(id specifier, NSString **outName, OOTextureFlags *outOptions, float *outAnisotropy, float *outLODBias, BOOL ignoreExtract)
Definition OOTexture.m:694
NSString *const kOOTextureSpecifierSwizzleKey
Definition OOTexture.m:46
static NSString * KeyFromTextureParameters(NSString *name, OOTextureFlags options, float anisotropy, float lodBias)

References KeyFromTextureParameters, nil, and OOInterpretTextureSpecifier().

+ Here is the call graph for this function:

◆ composeFragmentShader

- (void) composeFragmentShader

Definition at line 418 of file OODefaultShaderSynthesizer.m.

534{
535 while ([_fragmentBody hasSuffix:@"\t\n"])
536 {
537 [_fragmentBody deleteCharactersInRange:(NSRange){ [_fragmentBody length] - 2, 2 }];
538 }
539
540 NSMutableString *fragmentShader = [NSMutableString string];
543 AppendIfNotEmpty(fragmentShader, _fragmentHelpers, @"Helper functions");
545 if ([_fragmentTextureLookups length] > 0)
546 {
547 [fragmentShader appendString:@"\t\n\t// Texture lookups\n"];
548 [fragmentShader appendString:_fragmentTextureLookups];
549 }
550 [fragmentShader appendString:@"\t\n"];
551 [fragmentShader appendString:_fragmentBody];
552 [fragmentShader appendString:@"}"];
553
554#ifndef NDEBUG
555 _fragmentShader = [fragmentShader copy];
556#else
557 _fragmentShader = [fragmentShader retain];
558#endif
559}
static void AppendIfNotEmpty(NSMutableString *buffer, NSString *segment, NSString *name)

◆ composeVertexShader

- (void) composeVertexShader

Definition at line 418 of file OODefaultShaderSynthesizer.m.

511{
512 while ([_vertexBody hasSuffix:@"\t\n"])
513 {
514 [_vertexBody deleteCharactersInRange:(NSRange){ [_vertexBody length] - 2, 2 }];
515 }
516 [_vertexBody appendString:@"}"];
517
518 NSMutableString *vertexShader = [NSMutableString string];
522 AppendIfNotEmpty(vertexShader, _vertexHelpers, @"Helper functions");
524
525#ifndef NDEBUG
526 _vertexShader = [vertexShader copy];
527#else
528 _vertexShader = [vertexShader retain];
529#endif
530}

◆ createTemporaries

- (void) createTemporaries

Definition at line 580 of file OODefaultShaderSynthesizer.m.

754{
755 _attributes = [[NSMutableString alloc] init];
756 _varyings = [[NSMutableString alloc] init];
757 _vertexUniforms = [[NSMutableString alloc] init];
758 _fragmentUniforms = [[NSMutableString alloc] init];
759 _vertexHelpers = [[NSMutableString alloc] init];
760 _fragmentHelpers = [[NSMutableString alloc] init];
761 _vertexBody = [[NSMutableString alloc] init];
762 _fragmentPreTextures = [[NSMutableString alloc] init];
763 _fragmentTextureLookups = [[NSMutableString alloc] init];
764 _fragmentBody = [[NSMutableString alloc] init];
765
766 _textures = [[NSMutableArray alloc] init];
767 _texturesByName = [[NSMutableDictionary alloc] init];
768 _textureIDs = [[NSMutableDictionary alloc] init];
769 _sampledTextures = NSCreateHashTable(NSIntegerHashCallBacks, 0);
770
771 _uniformBindingNames = [[NSMutableDictionary alloc] init];
772
773#ifndef NDEBUG
774 _stagesInProgress = NSCreateHashTable(NSNonOwnedPointerHashCallBacks, 0);
775#endif
776}
NSMutableDictionary * _uniformBindingNames

◆ dealloc

- (void) dealloc
implementation

Definition at line 110 of file OODefaultShaderSynthesizer.m.

321{
322 [self destroyTemporaries];
329
330 [super dealloc];
331}
#define DESTROY(x)
Definition OOCocoa.h:77

◆ defineBindingUniform:ofType:

- (NSString *) defineBindingUniform: (NSDictionary *) binding
ofType: (NSString *) type 

Definition at line 418 of file OODefaultShaderSynthesizer.m.

477 :(NSDictionary *)binding ofType:(NSString *)type
478{
479 NSString *name = [binding oo_stringForKey:@"binding"];
480 NSParameterAssert([name length] > 0);
481
482 NSMutableDictionary *bindingSpec = [[binding mutableCopy] autorelease];
483 if ([bindingSpec oo_stringForKey:@"type"] == nil) [bindingSpec setObject:@"binding" forKey:@"type"];
484
485 // Use existing uniform if one is defined.
486 NSString *uniformName = [_uniformBindingNames objectForKey:bindingSpec];
487 if (uniformName != nil) return uniformName;
488
489 // Capitalize first char of name, and prepend u.
490 unichar firstChar = toupper([name characterAtIndex:0]);
491 NSString *baseName = [NSString stringWithFormat:@"u%C%@", firstChar, [name substringFromIndex:1]];
492
493 // Ensure name is unique.
494 name = baseName;
495 unsigned idx = 1;
496 while ([_uniforms objectForKey:name] != nil)
497 {
498 name = [NSString stringWithFormat:@"%@%u", baseName, ++idx];
499 }
500
501 [self addFragmentUniform:name ofType:type];
502
503 [_uniforms setObject:bindingSpec forKey:name];
504 [_uniformBindingNames setObject:name forKey:bindingSpec];
505
506 return name;
507}

◆ destroyTemporaries

- (void) destroyTemporaries

Definition at line 580 of file OODefaultShaderSynthesizer.m.

780{
791
794 if (_sampledTextures != NULL)
795 {
796 NSFreeHashTable(_sampledTextures);
797 _sampledTextures = NULL;
798 }
799
801
802#ifndef NDEBUG
803 if (_stagesInProgress != NULL)
804 {
805 NSFreeHashTable(_stagesInProgress);
806 _stagesInProgress = NULL;
807 }
808#endif
809}

◆ entityName

- (NSString *) entityName

Definition at line 110 of file OODefaultShaderSynthesizer.m.

400{
401 return _entityName;
402}

◆ fragmentShader

- (NSString *) fragmentShader

Definition at line 110 of file OODefaultShaderSynthesizer.m.

341{
342 return _fragmentShader;
343}

Referenced by OOSynthesizeMaterialShader().

+ Here is the caller graph for this function:

◆ GetExtractMode

+ (static NSString *) GetExtractMode (NSDictionary *) textureSpecifier
implementation

Definition at line 418 of file OODefaultShaderSynthesizer.m.

419{
420 NSString *result = nil;
421
422 NSString *rawMode = [textureSpecifier oo_stringForKey:kOOTextureSpecifierSwizzleKey];
423 if (rawMode != nil)
424 {
425 NSUInteger length = [rawMode length];
426 if (1 <= length && length <= 4)
427 {
428 static NSCharacterSet *nonRGBACharset = nil;
429 if (nonRGBACharset == nil)
430 {
431 nonRGBACharset = [[[NSCharacterSet characterSetWithCharactersInString:@"rgba"] invertedSet] retain];
432 }
433
434 if ([rawMode rangeOfCharacterFromSet:nonRGBACharset].location == NSNotFound)
435 {
436 result = rawMode;
437 }
438 }
439 }
440
441 return result;
442}

◆ getSampleName:andSwizzleOp:forTextureSpec:

- (void) getSampleName: (NSString **) outSampleName
andSwizzleOp: (NSString **) outSwizzleOp
forTextureSpec: (NSDictionary *) textureSpec 

Definition at line 580 of file OODefaultShaderSynthesizer.m.

674 :(NSString **)outSampleName andSwizzleOp:(NSString **)outSwizzleOp forTextureSpec:(NSDictionary *)textureSpec
675{
676 NSParameterAssert(outSampleName != NULL && outSwizzleOp != NULL && textureSpec != nil);
677
678 [self setUpOneTexture:textureSpec];
679 NSUInteger texID = [self textureIDForSpec:textureSpec];
680
681 *outSampleName = [NSString stringWithFormat:@"tex%luSample", texID];
682 *outSwizzleOp = GetExtractMode(textureSpec);
683}
static NSString * GetExtractMode(NSDictionary *textureSpecifier)

◆ initWithMaterialConfiguration:materialKey:entityName:

- (id) initWithMaterialConfiguration: (NSDictionary *) configuration
materialKey: (NSString *) materialKey
entityName: (NSString *) name 

Definition at line 110 of file OODefaultShaderSynthesizer.m.

305 :(NSDictionary *)configuration
306 materialKey:(NSString *)materialKey
307 entityName:(NSString *)name
308{
309 if ((self = [super init]))
310 {
311 _configuration = [CanonicalizeMaterialSpecifier(configuration, materialKey) retain];
312 _materialKey = [materialKey copy];
313 _entityName = [_entityName copy];
314 }
315
316 return self;
317}

◆ KeyFromTextureParameters

+ (static NSString *) KeyFromTextureParameters (NSString *) name
(OOTextureFlags) options
(float) anisotropy
(float) lodBias 
implementation

Definition at line 568 of file OODefaultShaderSynthesizer.m.

569{
570#ifndef NDEBUG
571 options = OOApplyTextureOptionDefaults(options);
572#endif
573
574 // Extraction modes are ignored in synthesized shaders, since we use swizzling instead.
575 options &= ~kOOTextureExtractChannelMask;
576
577 return [NSString stringWithFormat:@"%@:%X:%g:%g", name, options, anisotropy, lodBias];
578}
OOTextureFlags OOApplyTextureOptionDefaults(OOTextureFlags options)
Definition OOTexture.m:855

References OOApplyTextureOptionDefaults().

Referenced by assignIDForTexture:.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ KeyFromTextureSpec

+ (static NSString *) KeyFromTextureSpec (NSDictionary *) spec
implementation

Definition at line 580 of file OODefaultShaderSynthesizer.m.

581{
582 NSString *texName = nil;
583 OOTextureFlags texOptions;
584 float anisotropy, lodBias;
585 if (!OOInterpretTextureSpecifier(spec, &texName, &texOptions, &anisotropy, &lodBias, YES))
586 {
587 // OOInterpretTextureSpecifier() will have logged something.
588 [NSException raise:NSGenericException format:@"Invalid texture specifier"];
589 }
590
591 return KeyFromTextureParameters(texName, texOptions, anisotropy, lodBias);
592}

◆ materialKey

- (NSString *) materialKey

Definition at line 110 of file OODefaultShaderSynthesizer.m.

394{
395 return _materialKey;
396}

Referenced by CanonicalizeMaterialSpecifier().

+ Here is the caller graph for this function:

◆ performStage:

- (void) performStage: (SEL) stage

Definition at line 580 of file OODefaultShaderSynthesizer.m.

735 :(SEL)stage
736{
737 // Ensure that we aren’t recursing.
738 if (NSHashGet(_stagesInProgress, stage) != NULL)
739 {
740 OOLogERR(@"material.synthesis.error.recursion", @"Shader synthesis recursion for stage %@.", NSStringFromSelector(stage));
741 [NSException raise:NSInternalInconsistencyException format:@"stage recursion"];
742 }
743
744 NSHashInsertKnownAbsent(_stagesInProgress, stage);
745
746 [self performSelector:stage];
747
748 NSHashRemove(_stagesInProgress, stage);
749}

◆ readOneChannelForTextureSpec:mapName:

- (NSString *) readOneChannelForTextureSpec: (NSDictionary *) textureSpec
mapName: (NSString *) mapName 

Definition at line 580 of file OODefaultShaderSynthesizer.m.

712 :(NSDictionary *)textureSpec mapName:(NSString *)mapName
713{
714 NSString *sample, *swizzle;
715 [self getSampleName:&sample andSwizzleOp:&swizzle forTextureSpec:textureSpec];
716
717 if (swizzle == nil)
718 {
719 return [sample stringByAppendingString:@".r"];
720 }
721
722 NSUInteger channelCount = [swizzle length];
723
724 if (channelCount == 1)
725 {
726 return [NSString stringWithFormat:@"%@.%@", sample, swizzle];
727 }
728
729 OOLogWARN(@"material.synthesis.warning.extractionMismatch", @"The %@ map for material \"%@\" of \"%@\" specifies %lu channels to extract, but only %@ may be used.", mapName, [self materialKey], [self entityName], channelCount, @"1");
730 return nil;
731}
#define OOLogWARN(class, format,...)
Definition OOLogging.h:113

◆ readRGBForTextureSpec:mapName:

- (NSString *) readRGBForTextureSpec: (NSDictionary *) textureSpec
mapName: (NSString *) mapName 

Definition at line 580 of file OODefaultShaderSynthesizer.m.

686 :(NSDictionary *)textureSpec mapName:(NSString *)mapName
687{
688 NSString *sample, *swizzle;
689 [self getSampleName:&sample andSwizzleOp:&swizzle forTextureSpec:textureSpec];
690
691 if (swizzle == nil)
692 {
693 return [sample stringByAppendingString:@".rgb"];
694 }
695
696 NSUInteger channelCount = [swizzle length];
697
698 if (channelCount == 1)
699 {
700 return [NSString stringWithFormat:@"%@.%@%@%@", sample, swizzle, swizzle, swizzle];
701 }
702 else if (channelCount == 3)
703 {
704 return [NSString stringWithFormat:@"%@.%@", sample, swizzle];
705 }
706
707 OOLogWARN(@"material.synthesis.warning.extractionMismatch", @"The %@ map for material \"%@\" of \"%@\" specifies %lu channels to extract, but only %@ may be used.", mapName, [self materialKey], [self entityName], channelCount, @"1 or 3");
708 return nil;
709}

◆ run

- (BOOL) run

Definition at line 110 of file OODefaultShaderSynthesizer.m.

367{
368 [self createTemporaries];
369 _uniforms = [[NSMutableDictionary alloc] init];
370 [_vertexBody appendString:@"void main(void)\n{\n"];
371 [_fragmentPreTextures appendString:@"void main(void)\n{\n"];
372
373 @try
374 {
376
377 [self composeVertexShader];
378 [self composeFragmentShader];
379 }
380 @catch (NSException *exception)
381 {
382 // Error should have been reported already.
383 return NO;
384 }
385 @finally
386 {
387 [self destroyTemporaries];
388 }
389
390 return YES;
391}
#define REQUIRE_STAGE(NAME)

Referenced by OOSynthesizeMaterialShader().

+ Here is the caller graph for this function:

◆ setUpOneTexture:

- (void) setUpOneTexture: (NSDictionary *) textureSpec

Definition at line 580 of file OODefaultShaderSynthesizer.m.

659 :(NSDictionary *)textureSpec
660{
661 if (textureSpec == nil) return;
662
664
665 NSUInteger texID = [self assignIDForTexture:textureSpec];
666 if ((NSUInteger)NSHashGet(_sampledTextures, (const void *)(texID + 1)) == 0)
667 {
668 NSHashInsertKnownAbsent(_sampledTextures, (const void *)(texID + 1));
669 [_fragmentTextureLookups appendFormat:@"\tvec4 tex%luSample = texture2D(uTexture%lu, texCoords); // %@\n", texID, texID, [textureSpec oo_stringForKey:kOOTextureSpecifierNameKey]];
670 }
671}

◆ textureIDForSpec:

- (NSUInteger) textureIDForSpec: (NSDictionary *) textureSpec

Definition at line 580 of file OODefaultShaderSynthesizer.m.

653 :(NSDictionary *)textureSpec
654{
655 return [_textureIDs oo_unsignedIntegerForKey:KeyFromTextureSpec(textureSpec)];
656}

◆ textureSpecifications

- (NSArray *) textureSpecifications

Definition at line 110 of file OODefaultShaderSynthesizer.m.

347{
348#ifndef NDEBUG
349 return [NSArray arrayWithArray:_textures];
350#else
351 return _textures;
352#endif
353}

Referenced by OOSynthesizeMaterialShader().

+ Here is the caller graph for this function:

◆ uniformSpecifications

- (NSDictionary *) uniformSpecifications

Definition at line 110 of file OODefaultShaderSynthesizer.m.

357{
358#ifndef NDEBUG
359 return [NSDictionary dictionaryWithDictionary:_uniforms];
360#else
361 return _uniforms;
362#endif
363}

Referenced by OOSynthesizeMaterialShader().

+ Here is the caller graph for this function:

◆ vertexShader

- (NSString *) vertexShader

Definition at line 110 of file OODefaultShaderSynthesizer.m.

335{
336 return _vertexShader;
337}

Referenced by OOSynthesizeMaterialShader().

+ Here is the caller graph for this function:

◆ writeDiffuseColorTerm

- (void) writeDiffuseColorTerm

Definition at line 580 of file OODefaultShaderSynthesizer.m.

918{
920
921 if (!_usesDiffuseTerm)
922 {
923 [_fragmentBody appendString:@"\tconst vec3 diffuseColor = vec3(0.0); // Diffuse colour is black.\n\t\n"];
924 }
925}

◆ writeDiffuseColorTermIfNeeded

- (void) writeDiffuseColorTermIfNeeded

Definition at line 580 of file OODefaultShaderSynthesizer.m.

873{
874 NSDictionary *diffuseMap = [_configuration oo_diffuseMapSpecifierWithDefaultName:[self materialKey]];
875 OOColor *diffuseColor = [_configuration oo_diffuseColor] ?: [OOColor whiteColor];
876
877 if ([diffuseColor isBlack]) return;
878 _usesDiffuseTerm = YES;
879
880 BOOL haveDiffuseColor = NO;
881 if (diffuseMap != nil)
882 {
883 NSString *readInstr = [self readRGBForTextureSpec:diffuseMap mapName:@"diffuse"];
884 if (EXPECT_NOT(readInstr == nil))
885 {
886 [_fragmentBody appendString:@"\t// INVALID EXTRACTION KEY\n\t\n"];
887 }
888 else
889 {
890 [_fragmentBody appendFormat:@"\tvec3 diffuseColor = %@;\n", readInstr];
891 haveDiffuseColor = YES;
892 }
893 }
894
895 if (!haveDiffuseColor || ![diffuseColor isWhite])
896 {
897 float rgba[4];
898 [diffuseColor getRed:&rgba[0] green:&rgba[1] blue:&rgba[2] alpha:&rgba[3]];
899 NSString *format = nil;
900 if (haveDiffuseColor)
901 {
902 format = @"\tdiffuseColor *= vec3(%@, %@, %@);\n";
903 }
904 else
905 {
906 format = @"\tconst vec3 diffuseColor = vec3(%@, %@, %@);\n";
907 haveDiffuseColor = YES;
908 }
909 [_fragmentBody appendFormat:format, FormatFloat(rgba[0]), FormatFloat(rgba[1]), FormatFloat(rgba[2])];
910 }
911
912 (void) haveDiffuseColor;
913 [_fragmentBody appendString:@"\t\n"];
914}
#define EXPECT_NOT(x)
void getRed:green:blue:alpha:(float *red,[green] float *green,[blue] float *blue,[alpha] float *alpha)
Definition OOColor.m:368
OOColor * whiteColor()
Definition OOColor.m:256

◆ writeDiffuseLighting

- (void) writeDiffuseLighting

Definition at line 580 of file OODefaultShaderSynthesizer.m.

929{
931 if (!_usesDiffuseTerm) return;
932
937
938 // FIXME: currently uncoloured diffuse and ambient lighting.
939 NSString *normalDotLight = _constZNormal ? @"lightVector.z" : @"dot(normal, lightVector)";
940
941 [_fragmentBody appendFormat:
942 @"\t// Diffuse (Lambertian) and ambient lighting\n"
943 "\tvec3 diffuseLight = (gl_LightSource[1].diffuse * max(0.0, %@) + gl_LightModel.ambient).rgb;\n\t\n",
944 normalDotLight];
945
946 _haveDiffuseLight = YES;
947}

◆ writeEyeVector

- (void) writeEyeVector

Definition at line 580 of file OODefaultShaderSynthesizer.m.

965{
968
969 [self addVarying:@"vEyeVector" ofType:@"vec3"];
970
971 [_vertexBody appendString:@"\tvEyeVector = position.xyz * TBN;\n\t\n"];
972 [_fragmentPreTextures appendString:@"\tvec3 eyeVector = normalize(vEyeVector);\n\t\n"];
973}

◆ writeFinalColorComposite

- (void) writeFinalColorComposite

Definition at line 580 of file OODefaultShaderSynthesizer.m.

1307{
1308 REQUIRE_STAGE(writeTotalColor); // Needed even if none of the following stages does anything.
1312
1314 {
1315 [_fragmentBody appendString:@"\ttotalColor += diffuseColor * diffuseLight;\n"];
1316 }
1317
1318 [_fragmentBody appendString:@"\tgl_FragColor = vec4(totalColor, 1.0);\n\t\n"];
1319}

◆ writeLightMaps

- (void) writeLightMaps

Definition at line 580 of file OODefaultShaderSynthesizer.m.

1164{
1165 NSArray *lightMaps = [_configuration oo_arrayForKey:kOOMaterialLightMapsName];
1166 NSUInteger idx, count = [lightMaps count];
1167 if (count == 0) return;
1168
1170
1171 // Check if we need the diffuse colour term.
1172 for (idx = 0; idx < count; idx++)
1173 {
1174 NSDictionary *lightMapSpec = [lightMaps oo_dictionaryAtIndex:idx];
1175 if ([lightMapSpec oo_boolForKey:kOOTextureSpecifierIlluminationModeKey])
1176 {
1179 break;
1180 }
1181 }
1182
1183 [_fragmentBody appendString:@"\tvec3 lightMapColor;\n"];
1184
1185 for (idx = 0; idx < count; idx++)
1186 {
1187 NSDictionary *lightMapSpec = [lightMaps oo_dictionaryAtIndex:idx];
1188 NSDictionary *textureSpec = OOTextureSpecFromObject(lightMapSpec, nil);
1189 NSArray *color = [lightMapSpec oo_arrayForKey:kOOTextureSpecifierModulateColorKey];
1190 float rgba[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
1191 BOOL isIllumination = [lightMapSpec oo_boolForKey:kOOTextureSpecifierIlluminationModeKey];
1192
1193 if (EXPECT_NOT(color == nil && textureSpec == nil))
1194 {
1195 [_fragmentBody appendString:@"\t// Light map with neither colour nor texture has no effect.\n\t\n"];
1196 continue;
1197 }
1198
1199 if (color != nil)
1200 {
1201 NSUInteger idx, count = [color count];
1202 if (count > 4) count = 4;
1203 for (idx = 0; idx < count; idx++)
1204 {
1205 rgba[idx] = [color oo_doubleAtIndex:idx];
1206 }
1207 rgba[0] *= rgba[3]; rgba[1] *= rgba[3]; rgba[2] *= rgba[3];
1208 }
1209
1210 if (EXPECT_NOT((rgba[0] == 0.0f && rgba[1] == 0.0f && rgba[2] == 0.0f) ||
1211 (!_usesDiffuseTerm && isIllumination)))
1212 {
1213 [_fragmentBody appendString:@"\t// Light map tinted black has no effect.\n\t\n"];
1214 continue;
1215 }
1216
1217 if (textureSpec != nil)
1218 {
1219 NSString *readInstr = [self readRGBForTextureSpec:textureSpec mapName:@"light"];
1220 if (EXPECT_NOT(readInstr == nil))
1221 {
1222 [_fragmentBody appendString:@"\t// INVALID EXTRACTION KEY\n\n"];
1223 continue;
1224 }
1225
1226 [_fragmentBody appendFormat:@"\tlightMapColor = %@;\n", readInstr];
1227
1228 if (rgba[0] != 1.0f || rgba[1] != 1.0f || rgba[2] != 1.0f)
1229 {
1230 [_fragmentBody appendFormat:@"\tlightMapColor *= vec3(%@, %@, %@);\n", FormatFloat(rgba[0]), FormatFloat(rgba[1]), FormatFloat(rgba[2])];
1231 }
1232 }
1233 else
1234 {
1235 [_fragmentBody appendFormat:@"\tlightMapColor = vec3(%@, %@, %@);\n", FormatFloat(rgba[0]), FormatFloat(rgba[1]), FormatFloat(rgba[2])];
1236 }
1237
1238 NSDictionary *binding = [textureSpec oo_dictionaryForKey:kOOTextureSpecifierBindingKey];
1239 if (binding != nil)
1240 {
1241 NSString *bindingName = [binding oo_stringForKey:@"binding"];
1242 NSDictionary *typeDict = [[ResourceManager shaderBindingTypesDictionary] oo_dictionaryForKey:@"player"]; // FIXME: select appropriate binding subset.
1243 NSString *bindingType = [typeDict oo_stringForKey:bindingName];
1244 NSString *glslType = nil;
1245 NSString *swizzle = @"";
1246
1247 if ([bindingType isEqualToString:@"float"])
1248 {
1249 glslType = @"float";
1250 }
1251 else if ([bindingType isEqualToString:@"vector"])
1252 {
1253 glslType = @"vec3";
1254 }
1255 else if ([bindingType isEqualToString:@"color"])
1256 {
1257 glslType = @"vec4";
1258 swizzle = @".rgb";
1259 }
1260
1261 if (glslType != nil)
1262 {
1263 NSString *uniformName = [self defineBindingUniform:binding ofType:bindingType];
1264 [_fragmentBody appendFormat:@"\tlightMapColor *= %@%@;\n", uniformName, swizzle];
1265 }
1266 else
1267 {
1268 if (bindingType == nil)
1269 {
1270 OOLogERR(@"material.binding.error.unknown", @"Cannot bind light map to unknown attribute \"%@\".", bindingName);
1271 }
1272 else
1273 {
1274 OOLogERR(@"material.binding.error.badType", @"Cannot bind light map to attribute \"%@\" of type %@.", bindingName, bindingType);
1275 }
1276 [_fragmentBody appendString:@"\tlightMapColor = vec3(0.0); // Bad binding, see log.\n"];
1277 }
1278 }
1279
1280 if (!isIllumination)
1281 {
1282 [_fragmentBody appendString:@"\ttotalColor += lightMapColor;\n\t\n"];
1283 }
1284 else
1285 {
1286 [_fragmentBody appendString:@"\tdiffuseLight += lightMapColor;\n\t\n"];
1287 }
1288 }
1289}
unsigned count
NSDictionary * OOTextureSpecFromObject(id object, NSString *defaultName)
Definition OOTexture.m:647
NSString *const kOOTextureSpecifierIlluminationModeKey
Definition OOTexture.m:58
NSDictionary * shaderBindingTypesDictionary()

◆ writeLightVector

- (void) writeLightVector

Definition at line 580 of file OODefaultShaderSynthesizer.m.

951{
954
955 [self addVarying:@"vLightVector" ofType:@"vec3"];
956
957 [_vertexBody appendString:
958 @"\tvec3 lightVector = gl_LightSource[1].position.xyz;\n"
959 "\tvLightVector = lightVector * TBN;\n\t\n"];
960 [_fragmentBody appendFormat:@"\tvec3 lightVector = normalize(vLightVector);\n\t\n"];
961}

◆ writeNormal

- (void) writeNormal

Definition at line 580 of file OODefaultShaderSynthesizer.m.

1021{
1023
1024 if (_constZNormal)
1025 {
1026 [_fragmentBody appendString:@"\tconst vec3 normal = vec3(0.0, 0.0, 1.0);\n\t\n"];
1027 }
1028}

◆ writeNormalIfNeeded

- (void) writeNormalIfNeeded

Definition at line 580 of file OODefaultShaderSynthesizer.m.

990{
993
994 NSDictionary *normalMap = [_configuration oo_normalMapSpecifier];
995 if (normalMap == nil)
996 {
997 // FIXME: this stuff should be handled in OOMaterialSpecifier.m when synthesizer takes over the world. -- Ahruman 2012-02-08
998 normalMap = [_configuration oo_normalAndParallaxMapSpecifier];
999 }
1000 if (normalMap != nil)
1001 {
1002 NSString *sample, *swizzle;
1003 [self getSampleName:&sample andSwizzleOp:&swizzle forTextureSpec:normalMap];
1004 if (swizzle == nil) swizzle = @"rgb";
1005 if ([swizzle length] == 3)
1006 {
1007 [_fragmentBody appendFormat:@"\tvec3 normal = normalize(%@.%@ - 0.5);\n\t\n", sample, swizzle];
1008 _usesNormalMap = YES;
1009 return;
1010 }
1011 else
1012 {
1013 OOLogWARN(@"material.synthesis.warning.extractionMismatch", @"The %@ map for material \"%@\" of \"%@\" specifies %lu channels to extract, but only %@ may be used.", @"normal", [self materialKey], [self entityName], [swizzle length], @"3");
1014 }
1015 }
1016 _constZNormal = YES;
1017}

◆ writeSpecularLighting

- (void) writeSpecularLighting

Definition at line 580 of file OODefaultShaderSynthesizer.m.

1032{
1033 float specularExponent = [_configuration oo_specularExponent];
1034 if (specularExponent <= 0) return;
1035
1036 NSDictionary *specularColorMap = [_configuration oo_specularColorMapSpecifier];
1037 NSDictionary *specularExponentMap = [_configuration oo_specularExponentMapSpecifier];
1038 float scaleFactor = 1.0f;
1039
1040 if (specularColorMap)
1041 {
1042 scaleFactor = [specularColorMap oo_doubleForKey:kOOTextureSpecifierScaleFactorKey defaultValue:1.0f];
1043 }
1044
1045 OOColor *specularColor = nil;
1046 if (specularColorMap == nil)
1047 {
1048 specularColor = [_configuration oo_specularColor];
1049 }
1050 else
1051 {
1052 specularColor = [_configuration oo_specularModulateColor];
1053 }
1054
1055 if ([specularColor isBlack]) return;
1056
1057 BOOL modulateWithDiffuse = [specularColorMap oo_boolForKey:kOOTextureSpecifierSelfColorKey];
1058
1063 if (modulateWithDiffuse)
1064 {
1066 }
1067
1068 [_fragmentBody appendString:@"\t// Specular (Blinn-Phong) lighting\n"];
1069
1070 BOOL haveSpecularColor = NO;
1071 if (specularColorMap != nil)
1072 {
1073 NSString *readInstr = [self readRGBForTextureSpec:specularColorMap mapName:@"specular colour"];
1074 if (EXPECT_NOT(readInstr == nil))
1075 {
1076 [_fragmentBody appendString:@"\t// INVALID EXTRACTION KEY\n\t\n"];
1077 return;
1078 }
1079
1080 [_fragmentBody appendFormat:@"\tvec3 specularColor = %@;\n", readInstr];
1081 haveSpecularColor = YES;
1082 }
1083
1084 if (!haveSpecularColor || ![specularColor isWhite])
1085 {
1086 float rgba[4];
1087 [specularColor getRed:&rgba[0] green:&rgba[1] blue:&rgba[2] alpha:&rgba[3]];
1088
1089 NSString *comment = (scaleFactor == 1.0f) ? @"Constant colour" : @"Constant colour and scale factor";
1090
1091 // Handle scale factor, colour, and colour alpha scaling as one multiply.
1092 scaleFactor *= rgba[3];
1093 rgba[0] *= scaleFactor;
1094 rgba[1] *= scaleFactor;
1095 rgba[2] *= scaleFactor;
1096
1097 // Avoid reapplying scaleFactor below.
1098 scaleFactor = 1.0;
1099
1100 NSString *format = nil;
1101 if (haveSpecularColor)
1102 {
1103 format = @"\tspecularColor *= vec3(%@, %@, %@); // %@\n";
1104 }
1105 else
1106 {
1107 format = @"\tvec3 specularColor = vec3(%@, %@, %@); // %@\n";
1108 haveSpecularColor = YES;
1109 }
1110 [_fragmentBody appendFormat:format, FormatFloat(rgba[0]), FormatFloat(rgba[1]), FormatFloat(rgba[2]), comment];
1111 }
1112
1113 // Handle scale_factor if no constant colour.
1114 if (haveSpecularColor && scaleFactor != 1.0f)
1115 {
1116 [_fragmentBody appendFormat:@"\tspecularColor *= %@; // Scale factor\n", FormatFloat(scaleFactor)];
1117 }
1118
1119 // Handle self_color.
1120 if (modulateWithDiffuse)
1121 {
1122 [_fragmentBody appendString:@"\tspecularColor *= diffuseColor; // Self-colouring\n"];
1123 }
1124
1125 // Specular exponent.
1126 BOOL haveSpecularExponent = NO;
1127 if (specularExponentMap != nil)
1128 {
1129 NSString *readInstr = [self readOneChannelForTextureSpec:specularExponentMap mapName:@"specular exponent"];
1130 if (EXPECT_NOT(readInstr == nil))
1131 {
1132 [_fragmentBody appendString:@"\t// INVALID EXTRACTION KEY\n\t\n"];
1133 return;
1134 }
1135
1136 [_fragmentBody appendFormat:@"\tfloat specularExponent = %@ * %.1f;\n", readInstr, specularExponent];
1137 haveSpecularExponent = YES;
1138 }
1139 if (!haveSpecularExponent)
1140 {
1141 [_fragmentBody appendFormat:@"\tconst float specularExponent = %.1f;\n", specularExponent];
1142 }
1143
1144 if (_usesNormalMap)
1145 {
1146 [_fragmentBody appendFormat:@"\tvec3 reflection = reflect(lightVector, normal);\n"];
1147 }
1148 else
1149 {
1150 /* reflect(I, N) is defined as I - 2 * dot(N, I) * N
1151 If N is (0,0,1), this becomes (I.x,I.y,-I.z).
1152 */
1153 [_fragmentBody appendFormat:@"\tvec3 reflection = vec3(lightVector.x, lightVector.y, -lightVector.z); // Equivalent to reflect(lightVector, normal) since normal is known to be (0, 0, 1) in tangent space.\n"];
1154 }
1155
1156 [_fragmentBody appendFormat:
1157 @"\tfloat specIntensity = dot(reflection, eyeVector);\n"
1158 "\tspecIntensity = pow(max(0.0, specIntensity), specularExponent);\n"
1159 "\ttotalColor += specIntensity * specularColor * gl_LightSource[1].specular.rgb;\n\t\n"];
1160}

◆ writeTextureCoordRead

- (void) writeTextureCoordRead

Definition at line 580 of file OODefaultShaderSynthesizer.m.

815{
816 [self addVarying:@"vTexCoords" ofType:@"vec2"];
817 [_vertexBody appendString:@"\tvTexCoords = gl_MultiTexCoord0.st;\n\t\n"];
818
819 BOOL haveTexCoords = NO;
820 NSDictionary *parallaxMap = [_configuration oo_parallaxMapSpecifier];
821
822 if (parallaxMap != nil)
823 {
824 float parallaxScale = [_configuration oo_parallaxScale];
825 if (parallaxScale != 0.0f)
826 {
827 /*
828 We can’t call -getSampleName:... here because the standard
829 texture loading mechanism has to occur after determining
830 texture coordinates (duh).
831 */
832 NSString *swizzle = GetExtractMode(parallaxMap) ?: (NSString *)@"a";
833 NSUInteger channelCount = [swizzle length];
834 if (channelCount == 1)
835 {
836 haveTexCoords = YES;
837
839
840 [_fragmentPreTextures appendString:@"\t// Parallax mapping\n"];
841
842 NSUInteger texID = [self assignIDForTexture:parallaxMap];
843 [_fragmentPreTextures appendFormat:@"\tfloat parallax = texture2D(uTexture%lu, vTexCoords).%@;\n", texID, swizzle];
844
845 if (parallaxScale != 1.0f)
846 {
847 [_fragmentPreTextures appendFormat:@"\tparallax *= %@; // Parallax scale\n", FormatFloat(parallaxScale)];
848 }
849
850 float parallaxBias = [_configuration oo_parallaxBias];
851 if (parallaxBias != 0.0)
852 {
853 [_fragmentPreTextures appendFormat:@"\tparallax += %@; // Parallax bias\n", FormatFloat(parallaxBias)];
854 }
855
856 [_fragmentPreTextures appendString:@"\tvec2 texCoords = vTexCoords - parallax * eyeVector.xy * vec2(1.0, -1.0);\n"];
857 }
858 else
859 {
860 OOLogWARN(@"material.synthesis.warning.extractionMismatch", @"The %@ map for material \"%@\" of \"%@\" specifies %lu channels to extract, but only %@ may be used.", @"parallax", [self materialKey], [self entityName], channelCount, @"1");
861 }
862 }
863 }
864
865 if (!haveTexCoords)
866 {
867 [_fragmentPreTextures appendString:@"\tvec2 texCoords = vTexCoords;\n"];
868 }
869}

◆ writeTotalColor

- (void) writeTotalColor

Definition at line 580 of file OODefaultShaderSynthesizer.m.

1301{
1302 [_fragmentPreTextures appendString:@"\tvec3 totalColor = vec3(0.0);\n\t\n"];
1303}

◆ writeVertexPosition

- (void) writeVertexPosition

Definition at line 580 of file OODefaultShaderSynthesizer.m.

1293{
1294 [_vertexBody appendString:
1295 @"\tvec4 position = gl_ModelViewMatrix * gl_Vertex;\n"
1296 "\tgl_Position = gl_ProjectionMatrix * position;\n\t\n"];
1297}

◆ writeVertexTangentBasis

- (void) writeVertexTangentBasis

Definition at line 580 of file OODefaultShaderSynthesizer.m.

977{
978 [self addAttribute:@"tangent" ofType:@"vec3"];
979
980 [_vertexBody appendString:
981 @"\t// Build tangent space basis\n"
982 "\tvec3 n = gl_NormalMatrix * gl_Normal;\n"
983 "\tvec3 t = gl_NormalMatrix * tangent;\n"
984 "\tvec3 b = cross(n, t);\n"
985 "\tmat3 TBN = mat3(t, b, n);\n\t\n"];
986}

Member Data Documentation

◆ _attributes

- (NSMutableString*) _attributes
private

Definition at line 68 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeDiffuseColorTerm

- (NSUInteger) _completed_writeDiffuseColorTerm
private

Definition at line 95 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeDiffuseColorTermIfNeeded

- (NSUInteger) _completed_writeDiffuseColorTermIfNeeded
private

Definition at line 99 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeDiffuseLighting

- (NSUInteger) _completed_writeDiffuseLighting
private

Definition at line 98 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeEyeVector

- (NSUInteger) _completed_writeEyeVector
private

Definition at line 104 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeFinalColorComposite

- (NSUInteger) _completed_writeFinalColorComposite
private

Definition at line 94 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeLightMaps

- (NSUInteger) _completed_writeLightMaps
private

Definition at line 97 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeLightVector

- (NSUInteger) _completed_writeLightVector
private

Definition at line 103 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeNormalIfNeeded

- (NSUInteger) _completed_writeNormalIfNeeded
private

Definition at line 101 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeSpecularLighting

- (NSUInteger) _completed_writeSpecularLighting
private

Definition at line 96 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeTextureCoordRead

- (NSUInteger) _completed_writeTextureCoordRead
private

Definition at line 106 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeTotalColor

- (NSUInteger) _completed_writeTotalColor
private

Definition at line 105 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeVertexPosition

- (NSUInteger) _completed_writeVertexPosition
private

Definition at line 100 of file OODefaultShaderSynthesizer.m.

◆ _completed_writeVertexTangentBasis

- (NSUInteger) _completed_writeVertexTangentBasis
private

Definition at line 107 of file OODefaultShaderSynthesizer.m.

◆ _configuration

- (NSDictionary*) _configuration
private

Definition at line 59 of file OODefaultShaderSynthesizer.m.

◆ _constZNormal

- (NSUInteger) _constZNormal
private

Definition at line 90 of file OODefaultShaderSynthesizer.m.

◆ _entityName

- (NSString*) _entityName
private

Definition at line 61 of file OODefaultShaderSynthesizer.m.

◆ _fragmentBody

- (NSMutableString*) _fragmentBody
private

Definition at line 77 of file OODefaultShaderSynthesizer.m.

◆ _fragmentHelpers

- (NSMutableString*) _fragmentHelpers
private

Definition at line 73 of file OODefaultShaderSynthesizer.m.

◆ _fragmentPreTextures

- (NSMutableString*) _fragmentPreTextures
private

Definition at line 75 of file OODefaultShaderSynthesizer.m.

◆ _fragmentShader

- (NSString*) _fragmentShader
private

Definition at line 64 of file OODefaultShaderSynthesizer.m.

◆ _fragmentTextureLookups

- (NSMutableString*) _fragmentTextureLookups
private

Definition at line 76 of file OODefaultShaderSynthesizer.m.

◆ _fragmentUniforms

- (NSMutableString*) _fragmentUniforms
private

Definition at line 71 of file OODefaultShaderSynthesizer.m.

◆ _haveDiffuseLight

- (NSUInteger) _haveDiffuseLight
private

Definition at line 91 of file OODefaultShaderSynthesizer.m.

◆ _materialKey

- (NSString*) _materialKey
private

Definition at line 60 of file OODefaultShaderSynthesizer.m.

◆ _sampledTextures

- (NSHashTable*) _sampledTextures
private

Definition at line 84 of file OODefaultShaderSynthesizer.m.

◆ _stagesInProgress

- (NSHashTable*) _stagesInProgress
private

Definition at line 110 of file OODefaultShaderSynthesizer.m.

◆ _textureIDs

- (NSMutableDictionary*) _textureIDs
private

Definition at line 82 of file OODefaultShaderSynthesizer.m.

◆ _textures

- (NSMutableArray*) _textures
private

Definition at line 65 of file OODefaultShaderSynthesizer.m.

◆ _texturesByName

- (NSMutableDictionary*) _texturesByName
private

Definition at line 80 of file OODefaultShaderSynthesizer.m.

◆ _uniformBindingNames

- (NSMutableDictionary*) _uniformBindingNames
private

Definition at line 86 of file OODefaultShaderSynthesizer.m.

◆ _uniforms

- (NSMutableDictionary*) _uniforms
private

Definition at line 66 of file OODefaultShaderSynthesizer.m.

◆ _usesDiffuseTerm

- (NSUInteger) _usesDiffuseTerm
private

Definition at line 89 of file OODefaultShaderSynthesizer.m.

◆ _usesNormalMap

- (NSUInteger) _usesNormalMap
private

Definition at line 88 of file OODefaultShaderSynthesizer.m.

◆ _varyings

- (NSMutableString*) _varyings
private

Definition at line 69 of file OODefaultShaderSynthesizer.m.

◆ _vertexBody

- (NSMutableString*) _vertexBody
private

Definition at line 74 of file OODefaultShaderSynthesizer.m.

◆ _vertexHelpers

- (NSMutableString*) _vertexHelpers
private

Definition at line 72 of file OODefaultShaderSynthesizer.m.

◆ _vertexShader

- (NSString*) _vertexShader
private

Definition at line 63 of file OODefaultShaderSynthesizer.m.

◆ _vertexUniforms

- (NSMutableString*) _vertexUniforms
private

Definition at line 70 of file OODefaultShaderSynthesizer.m.


The documentation for this class was generated from the following file: