Base object for representing shader environment data.
#include <AlEnvironment.h>
class AlEnvironment : public AlObject,
virtual ~AlEnvironment();
virtual AlObjectType type() const;
virtual const char* name() const;
virtual statusCode deleteObject();
virtual AlObject* copyWrapper() const;
AlTexture* firstTexture() const;
AlTexture* nextTexture( AlTexture* ) const;
statusCode nextTextureD( AlTexture* ) const;
statusCode parameter( const AlShadingFields, double& ) const;
statusCode setParameter( const AlShadingFields, const double );
AlList* fields() const;
AlList* mappedFields() const;
statusCode addTexture( const char*, const char*, AlTexture** = NULL );
statusCode removeTexture( const char* );
statusCode applyIteratorToTextures( AlIterator *, int& );
This class encapsulates the basic functionality for checking and setting the name of an environment. It also encapsulates accessing the textures that a particular environment refers to, and the animation on the environment. When the wire file is read, the environment contained therein are created as an AlEnvironment class object. This environment object is accessible through the AlUniverse class.
An environment object may reference textures. The firstTexture and nextTexture methods are used to access these textures.
firstTexture() returns the first texture that the environment object references. nextTexture() moves from a given referenced texture to the next texture in order, as related to the environment object. (See the similar methods for the AlTexture/AlShader classes.)
The animation on the environment can be accessed through the firstChannel() and nextChannel() methods. All the channels on the environment can be deleted by calling deleteAnimation().
The environment parameters can be accessed through the parameter() and setParameter() methods. Each shader has a specific set of parameters that are valid for it that depend on its type. The full list of environment parameters can be seen in the file AlAnim.h. For example, all parameters specific to the Blinn shader have names of the form kFLD_SHADING_BLINN_*. Parameters common to all shaders have the form kFLD_SHADING_COMMON_*. All parameters are treated as doubles even though this may not necessarily be what they are. This is done to make the interface as simple and consistent as possible.
The user can neither create nor destroy an AlEnvironment class object at this time.
statusCode AlEnvironment::setParameter( const AlShadingFields field,const double value )
AlTexture* AlEnvironment::nextTexture( AlTexture* last_texture ) const
statusCode AlEnvironment::nextTextureD( AlTexture* last_texture ) const
statusCode AlEnvironment::removeTexture( const char* fieldName )
Removes a texture from a particular field of the AlEnvironment. The first argument is the name of the field which will have the texture applied to it. Only those fields valid for this shader should be provided; any others will cause this method to fail. Valid fields are any returned by the fields() method.
statusCode AlEnvironment::addTexture( const char* fieldName, const char* textureName, AlTexture** returnCreatedTexture )
Adds a texture to a particular field of the AlEnvironment. The first argument is the name of the field that will have the texture applied to it. Only those fields valid for this environment should be provided; any others will cause this method to fail. Valid fields are any returned by the fields() method. The second argument is the name of the texture type to apply to the field. The complete list of names is available in the SDL manual.
statusCode AlEnvironment::applyIteratorToTextures( AlIterator *iter, int &rc )
Applies the given AlIterator to all textures of this environment. The second argument will be set to the return value of the last application of the iterator’s function. See the AlIterator class for more information.