Inherits from NSObject
Conforms to CC3ShaderSemanticsDelegate
Declared in CC3ShaderSemantics.h

Overview

CC3ShaderSemanticsBase is an abstract implementation of the CC3ShaderSemanticsDelegate protocol, that retrieves common uniform values from the scene based on those semantics.

This implementation can be used as a superclass for other implementations. Semantic assigment heuristics may be radically different across implementations, but there is much commonality in the retrieval and assignment of uniform variables using the populateUniform:withVisitor: method. In many cases, subclassing this implementation, and using the inherited populateUniform:withVisitor: method, possibly overriding to provide additional variable assignment behaviour, can provide significant useful functionality.

This implementation does not provide any behaviour for the configureVariable: method, which simply returns NO.

The nameOfSemantic: method returns a name for each standard semantics defined in the CC3Semantic enumeration. If a subclass adds additional semantic definitions of its own, it should override that method to provide a string representation of the semantic value.

Class Methods

semanticsDelegate

Allocates and initializes an autoreleased instance.

+ (id)semanticsDelegate

Declared In

CC3ShaderSemantics.h

Instance Methods

configureVariable:

This implementation does not provide any configuration behaviour, and simply returns NO.

- (BOOL)configureVariable:(CC3GLSLVariable *)variable

Discussion

Subclasses will add behaviour to configure variables according to customized semantic mapping.

Declared In

CC3ShaderSemantics.h

nameOfSemantic:

Returns a string description of the specified semantic.

- (NSString *)nameOfSemantic:(GLenum)semantic

Discussion

This implementation calls the NSStringFromCC3Semantic method to return a name for each of the standard semantics defined in the CC3Semantic enumeration. If a subclass adds additional semantic definitions of its own, it should override this method to provide a string representation of any new semantic values.

Declared In

CC3ShaderSemantics.h

populateUniform:withVisitor:

Populates the specified uniform from standard content extracted from the scene.

- (BOOL)populateUniform:(CC3GLSLUniform *)uniform withVisitor:(CC3NodeDrawingVisitor *)visitor

Discussion

This implementation provides significant standard behaviour for most standard semantics. Subclasses can use this as a starting point, and add content extraction for customized semantics, or can override the behaviour of this method for specific uniforms or semantics.

Declared In

CC3ShaderSemantics.h