com.threerings.opengl.renderer.config
Class ShaderConfig

java.lang.Object
  extended by com.threerings.util.DeepObject
      extended by com.threerings.config.ManagedConfig
          extended by com.threerings.config.ParameterizedConfig
              extended by com.threerings.opengl.renderer.config.ShaderConfig
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>, Exportable, ResourceManager.ModificationObserver, Copyable, Cloneable

public class ShaderConfig
extends ParameterizedConfig

Shader metadata.


Nested Class Summary
static class ShaderConfig.ArrayRefUniformConfig<T>
          Base class for configs representing uniform arrays whose values come from references to scoped variables.
static class ShaderConfig.BooleanDefinition
          A boolean definition.
static class ShaderConfig.BooleanExprUniformConfig
          A boolean-valued uniform whose value is derived from an expression.
static class ShaderConfig.BooleanUniformConfig
          A boolean-valued uniform.
static class ShaderConfig.ColorDefinition
          A color-valued definition.
static class ShaderConfig.ColorExprUniformConfig
          A color-valued uniform whose value is derived from an expression.
static class ShaderConfig.ColorUniformConfig
          A color-valued uniform.
static class ShaderConfig.Definition
          Represents a preprocessor definition.
static class ShaderConfig.Derived
          A derived implementation.
static class ShaderConfig.ExpressionUniformConfig
          Base class for expression-derived uniforms.
static class ShaderConfig.FloatDefinition
          A float-valued definition.
static class ShaderConfig.FloatExprUniformConfig
          A float-valued uniform whose value is derived from an expression.
static class ShaderConfig.FloatUniformConfig
          A float-valued uniform.
static class ShaderConfig.FogBlendSnippet
          Defines a snippet that blends in the fog according to the fog parameter to simulate the behavior of the fixed-function pipeline.
static class ShaderConfig.FogParamSnippet
          Defines a snippet that sets the fog parameter value to simulate the behavior of the fixed-function pipeline.
static class ShaderConfig.Fragment
          A fragment shader.
static class ShaderConfig.FragmentLightingSnippet
          Defines a snippet that computes the fragment color based on the lighting parameters.
static class ShaderConfig.Implementation
          Contains the actual implementation of the shader.
static class ShaderConfig.IntegerDefinition
          An integer-valued definition.
static class ShaderConfig.IntegerExprUniformConfig
          An integer-valued uniform whose value is derived from an expression.
static class ShaderConfig.IntegerUniformConfig
          An integer-valued uniform.
static class ShaderConfig.MatrixArrayRefUniformConfig
          References an array of matrices.
static class ShaderConfig.Original
          The superclass of the original implementations.
static class ShaderConfig.PolarUniformConfig
          A polar coordinate-valued uniform.
static class ShaderConfig.SimpleUniformConfig
          Base class for simple uniforms.
static class ShaderConfig.StringDefinition
          A string-valued definition.
static class ShaderConfig.TexCoordSnippet
          Defines a snippet that sets the tex coords to simulate the behavior of the fixed-function pipeline.
static class ShaderConfig.TransformDefinition
          A transform-valued definition.
static class ShaderConfig.TransformExprUniformConfig
          A transform-valued uniform whose value is derived from an expression.
static class ShaderConfig.TransformUniformConfig
          A transform-valued uniform.
static class ShaderConfig.UniformConfig
          Represents the configuration of one or more shader uniforms.
static class ShaderConfig.Vertex
          A vertex shader.
static class ShaderConfig.VertexLightingSnippet
          Defines a snippet that sets the front and/or back colors to simulate the behavior of the fixed-function pipeline.
 
Field Summary
protected static int FIRST_VERTEX_ATTRIB_INDEX
          The index of the first vertex attribute (earlier ones are reserved).
protected static DecimalFormat GLSL_FLOAT
          Formats floats so that they will be recognized as float constants in GLSL.
 ShaderConfig.Implementation implementation
          The actual shader implementation.
 
Fields inherited from class com.threerings.config.ParameterizedConfig
_args, _base, _derived, parameters
 
Fields inherited from class com.threerings.config.ManagedConfig
_cfgmgr, _listeners, _name, _updateConfigs, _updateResources
 
Constructor Summary
ShaderConfig()
           
 
Method Summary
 Shader getShader(GlContext ctx, Scope scope, RenderState[] states, boolean vertexProgramTwoSide)
          Returns the shader corresponding to this configuration.
 ShaderConfig.UniformConfig[] getUniforms(GlContext ctx)
          Returns the array of uniforms for this configuration.
protected  void getUpdateReferences(ConfigReferenceSet refs)
          Collects all of the references within this config to configs that, when updated, should trigger a call to ManagedConfig.fireConfigUpdated().
protected  void getUpdateResources(HashSet<String> paths)
          Collects the paths of all resources referenced by this config that, when modified, should trigger a call to ManagedConfig.fireConfigUpdated().
 void populateDescriptor(GlContext ctx, PassDescriptor desc)
          Populates the relevant portion of the supplied descriptor.
 
Methods inherited from class com.threerings.config.ParameterizedConfig
applyArguments, applyArguments, getBound, getInstance, getParameter, getParameter, getReference, maybeFireOnConfigManager, validateOuters, validateReferences, wasUpdated
 
Methods inherited from class com.threerings.config.ManagedConfig
addListener, addUpdateDependencies, clearUpdateDependencies, configUpdated, fireConfigUpdated, getConfigManager, getInstance, getInstance, getInstance, getInstance, getName, init, removeListener, resourceModified, setName, updateFromSource
 
Methods inherited from class com.threerings.util.DeepObject
clone, copy, copy, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

implementation

@Editable
public ShaderConfig.Implementation implementation
The actual shader implementation.


GLSL_FLOAT

protected static final DecimalFormat GLSL_FLOAT
Formats floats so that they will be recognized as float constants in GLSL.


FIRST_VERTEX_ATTRIB_INDEX

protected static final int FIRST_VERTEX_ATTRIB_INDEX
The index of the first vertex attribute (earlier ones are reserved).

See Also:
Constant Field Values
Constructor Detail

ShaderConfig

public ShaderConfig()
Method Detail

populateDescriptor

public void populateDescriptor(GlContext ctx,
                               PassDescriptor desc)
Populates the relevant portion of the supplied descriptor.


getShader

public Shader getShader(GlContext ctx,
                        Scope scope,
                        RenderState[] states,
                        boolean vertexProgramTwoSide)
Returns the shader corresponding to this configuration.


getUniforms

public ShaderConfig.UniformConfig[] getUniforms(GlContext ctx)
Returns the array of uniforms for this configuration.


getUpdateReferences

protected void getUpdateReferences(ConfigReferenceSet refs)
Description copied from class: ManagedConfig
Collects all of the references within this config to configs that, when updated, should trigger a call to ManagedConfig.fireConfigUpdated().

Overrides:
getUpdateReferences in class ManagedConfig

getUpdateResources

protected void getUpdateResources(HashSet<String> paths)
Description copied from class: ManagedConfig
Collects the paths of all resources referenced by this config that, when modified, should trigger a call to ManagedConfig.fireConfigUpdated().

Overrides:
getUpdateResources in class ManagedConfig