v2.0.2
Instance Methods | List of all members
CC3PFXShaderSemantics Class Reference

#import <CC3PFXResource.h>

Inheritance diagram for CC3PFXShaderSemantics:
Inheritance graph
[legend]

Instance Methods

(void) - populateWithVariableNameMappingsFromPFXEffect:
 
(BOOL) - resolveSemanticForVariableConfiguration:
 
(GLenum) - semanticForPFXSemanticName:
 
- Instance Methods inherited from CC3ShaderSemanticsByVarName
(void) - __deprecated
 
(void) - __deprecated
 
(void) - addVariableConfiguration:
 
(BOOL) - configureVariable:
 
(void) - mapVarName:toSemantic:
 
(void) - mapVarName:toSemantic:at:
 
(void) - populateWithDefaultVariableNameMappings
 
- Instance Methods inherited from CC3ShaderSemanticsBase
(NSString *) - nameOfSemantic:
 
(BOOL) - populateUniform:withVisitor:
 

Additional Inherited Members

- Class Methods inherited from CC3ShaderSemanticsBase
(id) + semanticsDelegate
 

Detailed Description

CC3PFXShaderSemantics provides a mapping from the PFX semantic names declared in a PFX effect within a PFX effects file, and the standard semantics from the CC3Semantic enumeration.

GLSL shader code loaded from a PFX effect can mix custom semantics defined within the PFX effect with standard default semantics defined by the semantic delegate associated with the program matcher. If a GLSL variable cannot be configured based on a semantic definition for its name within the PFX effect, configuration of the variable is delegated to the standard semantic delegate at CC3ShaderProgram.shaderMatcher.semanticDelegate. It is even possible to load shaders that use only standard semantic naming, without having to define any semantics within the PFX effect.

This is an abstract implementation. Subclasses can override the semanticForPFXSemanticName: method for simple name-based mapping, or can override the resolveSemanticForVariableConfiguration: for more complex mapping.

Method Documentation

- (void) populateWithVariableNameMappingsFromPFXEffect: (CC3PFXEffect *)  pfxEffect

Populates this instance with the mappings between variable names and semantics defined in the specified PFX effect.

In the process of doing so, the semantic of each variable is resolved from the PFX semantic name of the variable configuration.

For each variable configuration in the variables property of the specified PFX effect, this method invokes the resolveSemanticForVariableConfiguration: and addVariableConfiguration: methods to resolve the variable configuration and add it to this semantic mapping.

This method is invoked automatically during the parsing of the PFX file.

- (BOOL) resolveSemanticForVariableConfiguration: (CC3PFXGLSLVariableConfiguration *)  pfxVarConfig

If the semantic property of the specified variable configuration has not already been set, it is set by resolving it from the PFX semantic name of the specified variable configuration.

Returns whether the semantic has been resolved. Subclasses that override this method can first invoke this superclass implementation, and then use the return value to resolve any custom semantics.

The default behaviour is to invoke the semanticForPFXSemanticName: method with the value of the pfxSemanticName property of the specified variable configuration, and if it returns a valid semantic value, the semantic value is set in the specified variable configuration and this method returns YES. If the semanticForPFXSemanticName: method returns kCC3SemanticNone, the semantic of the specified variable configuration is not set, and this method returns NO.

- (GLenum) semanticForPFXSemanticName: (NSString *)  semanticName

Returns the semantic value corresponding the the specified PFX semantic name, or returns kCC3SemanticNone if the semantic could not be determined from the PFX semantic name.

This implementation does nothing and simply returns kCC3SemanticNone. Subclasses will override.

Implemented in CC3PVRShamanShaderSemantics.


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