#include <AlTexture.h>
class AlTexture : public AlObject,
virtual ~AlTexture();
virtual statusCode deleteObject();
virtual AlObject *copyWrapper() const;
virtual AlAnimatable* asAnimatablePtr();
virtual AlObjectType type() const;
virtual AlTexture* asTexturePtr();
virtual const char* name() const;
virtual statusCode setName(const char *);
AlTexture* firstTexture() const;
AlTexture* nextTexture( const AlTexture* ) const;
statusCode nextTextureD( AlTexture* );
const char* textureType() const;
const char* fieldType() const;
statusCode parameter( const AlShadingFields, double* ) const;
statusCode parameter( const AlShadingFields, double& ) const;
statusCode setParameter( const AlShadingFields, const double );
/* this section is only for file textures */
const char* filename() const;
statusCode setFilename( const char* );
const char* firstPerObjectPixEntry();
const char* nextPerObjectPixEntry( const char *);
const char* getPerObjectPixFilename( const char*) const;
statusCode setPerObjectPixFilename( const char*, const char*);
statusCode addPerObjectPixEntry( const char*, const char*);
statusCode removePerObjectPixEntry( const char* );
boolean isParametric( void ) const;
statusCode eval( double, double, double, double, double, double, double,
double, double, double, double*, double*, double*,
double*, boolean = TRUE, double = 1.0, double = 0.0, char
*objectname = NULL ) const;
statusCode parameterize( AlPolyset *, const int,
const boolean,const boolean ) const;
AlList* fields() const;
AlList* mappedFields() const;
statusCode addTexture( const char*, const char*, AlTexture**
returnedTexture = NULL );
statusCode removeTexture( const char* );
AlTextureNode* textureNode() const;
statusCode applyIteratorToTextures( AlIterator*, int& );
A texture object itself may also reference other textures. For this reason the firstTexture() and nextTexture() methods are used.
firstTexture() returns the first texture that the texture object references. nextTexture() moves from a given referenced texture to the next texture in order, as related to the texture object. (See the similar methods for the AlShader/AlEnvironment classes.)
The animation on a texture can be accessed through the firstChannel() and nextChannel() methods. All the channels on the texture can be deleted by calling deleteAnimation().
Summary
AlTexture::AlTexture()
Description
This constructor creates an AlTexture wrapper object. AlTexture::~AlTexture()
Description
Deletes an AlTexture wrapper object. statusCode AlTexture::deleteObject()
Description
Deletes the AlTexture and the AlTextures hanging off of the texture. If an AlTextureNode is attached to this texture, it will be deleted as well. Note that after this operation any pointers to AlTextures that had been part of this texture will no longer be valid. Return codes
sSuccess - the object was deleted AlObject *AlTexture::copyWrapper() const
Description
Return an exact duplicate of this AlTexture wrapper. AlObjectType AlTexture::type() const
Description
Returns the class identifier 'kTextureType'. AlTexture* AlTexture::asTexturePtr()
Description
This virtual function returns a non-null pointer to itself, indicating that it is safe to cast to an object of this class. const char* AlTexture::name() const
Description
Returns the name of the texture. statusCode AlTexture::setName( const char *newName )
Description
Changes the name of the texture to a new name. If the given name is not a unique one or contains illegal characters, then a unique name is generated based on the given name and assigned to the texture. In this case, a status code of sNameChangedToUniqueOne is returned. It is illegal for the new name to be NULL. #, digits, upper case letters, lower case letters, and _ are valid characters Arguments
< newName - new name of the object Return codes
sSuccess - name was changed AlTexture* AlTexture::firstTexture() const
Description
Returns the first texture that this texture object references. If there are none then NULL is returned. AlTexture* AlTexture::nextTexture( const AlTexture* last_texture ) const
Description
Returns the texture after the given one in the texture's list of subtextures. Specifying NULL as a parameter will return the first texture. Arguments
< last_texture - Texture from which to walk forward statusCode AlTexture::nextTextureD( AlTexture* last_texture )
Description
Destructively points the given texture wrapper to the next texture. Arguments
< last_texture - Texture from which to walk forward Return codes
sSuccess - the wrapper now points to the next object in the list const char* AlTexture::textureType() const
Description
Returns a string which indicates the "name" of the texture type. Note that these strings are identical to those output to SDL. const char* AlTexture::fieldType() const
Description
Returns a string which indicates which field of the parent object (AlShader, AlTexture, AlEnvironment) that this texture is mapped to. Note that the returned strings are identical to the field names written out to SDL. The SDL manual gives a complete list of possible return values for this function. statusCode AlTexture::parameter( const AlShadingFields field,double& result)const
Description
This method finds the value of a given texture field. Arguments
< field - texture field type Return codes
sSuccess - field was returned statusCode AlTexture::setParameter( const AlShadingFields field,const double value)
Description
Changes the value of the texture field. Arguments
< field - texture field type Return codes
sSuccess - field was changed const char* AlTexture::filename() const
Description
If the texture is a file texture, this method returns the path and name to the image file used for the texture. If the texture is any other type, NULL is returned. statusCode AlTexture::setFilename(const char* filename)
Description
If the texture is a file texture, this method sets the path and name to the image file used for the texture. If the texture is any other type, sFailure is returned. Note that the string provided is duplicated, so you are responsible for the space allocated for the original copy. Arguments
< filename - the filename to set in the texture Return codes
sSuccess - the path name was set const char* AlTexture::firstPerObjectPixEntry()
Description
If the texture is a file texture, this method returns the name of the first object in the Per Object Pix list of the file texture. If the list is empty, or if the texture is not a file texture, then NULL is returned. const char* AlTexture::nextPerObjectPixEntry( const char* prev_objname )
Description
If the texture is a file texture and the objname is in the per object pix file list of the texture, this method returns the name of the next object after prev_objname. If no such object exists, or if the texture is not a file texture, then NULL is returned. const char* AlTexture::getPerObjectPixFilename( const char* objname ) const
Description
If the texture is a file texture and the objname is in the "per object pix file" list of the texture, this method returns the image file used for the objname object (object meaning an Alias geometry). If the object is not in the list, then the image file used will be AlTexture::filename() which contains the texture that is applied to all objects that are not specifically mentioned in the "per object pix file" list. If the return value of getPerObjectPixFilename() is NULL, then the object is not textured. Arguments
< objname - the name of the object to query for a filename Return code
char pointer to an allocated string holding the filename or NULL - failure statusCode AlTexture::setPerObjectPixFilename( const char* objname,const char* filename )
Description
If the texture is a file texture and the objname exists in the per obj pix list, this method sets the name of the image file use for that object (object in the sense of an Alias geometry). Otherwise, sFailure is returned (not file texture or object doesn't exist). The filename string is duplicated, so you are responsible for the space allocated for the original copy Arguments
< objname - name of the object whose filename is to be set Return codes
sSuccess - the path name was set sFailure - the name was not set sInvalidObject - the texture is invalid statusCode AlTexture::addPerObjectPixEntry( const char* objname,const char* filename )
Description
If the texture is a file texture, this method adds a per object pix entry to the texture. If the texture is any other type, sFailure is returned. If the objname object is not already in the per object pix entry list, it is added. If the objname object does exist in the list, its filename field is modified to contain the given filename. Arguments
< objname - name of the object whose filename is to be set Return codes
sSuccess - the path name was set statusCode AlTexture::removePerObjectPixEntry( const char* objname )
Description
If the texture is a file texture and the objname object is found in the per object pix list, this method will delete that item from the per object pick list. If the texture is not a file texture, sFailure is returned. Arguments
< objname - specifies the name of the object in the per object pix list to delete Return codes
sSuccess - the path name was set boolean AlTexture::isParametric() const
Description
This method indicates whether the texture is a parametric texture or a solid/environment texture. TRUE is returned if the texture is parametric. AlList* AlTexture::fields() const
Description
This method returns an AlList of AlShadingFieldItems, each of which contains an AlShadingFields value valid for this texture. AlList* AlTexture::mappedFields() const
Description
This method returns an AlList of AlMappedFieldItems, each of which contains a character string identifier identifying a field on this texture that may be texture mapped. Note that these strings are identical to the SDL identifiers and the complete list can be found in the SDL manual. statusCode AlTexture::removeTexture( const char* fieldName )
Description
This method removes a texture to a particular field of the AlTexture. The first argument is the name of the field that will have the texture applied to it. Only those fields valid for this texture should be provided; any others will cause this method to fail. Valid fields are any returned by the fields() method. Arguments
< fieldName - name of the field which will have the texture removed from it Return codes
sSuccess - the texture was removed successfully. statusCode AlTexture::addTexture( const char* fieldName, const char* textureName, AlTexture** returnCreatedTexture )
Description
This method adds a texture to a particular field of the AlTexture. The first argument is the name of the field which will have the texture applied to it. Only those fields valid for this texture 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. Arguments
< fieldName - name of the field which will have the texture applied to it Return codes
sSuccess - the texture was added successfully. AlTextureNode* AlTexture::textureNode() const
Description
This method returns a pointer to the transformation AlTextureNode on solid textures. If the texture is not a solid texture or there is no AlTextureNode, this method returns NULL. statusCode AlTexture::eval( double u, double v, double x, double y, double z, double nx, double ny, double nz, double usize, double vsize, double *r, double *g, double *b, double *a, boolean initialize, double blurmult, double bluroffset, char *objectname ) const
Description
This method evaluates a texture at the passed location. The initialize flag specifies whether the texture transforms should be initialized. Note that this is a costly operation, so initialize only when necessary, generally on the first call. Arguments
< u, v - specify the parametric location at the evaluated point. Return codes
sSuccess - the texture was evaluated successfully. statusCode AlTexture::parameterize( AlPolyset *pset, const int shaderNumber, const boolean seamCorrect, const boolean seamNormalize ) const
Description:
This method applies any transformations associated with the texture map to the texture vertices of the supplied polyset. The texture vertices of the polyset are replaced with texture vertices that are computed from the texture transformation. Arguments:
< > pset - A pointer to an AlPolyset wrapper to specify the polyset to be modified. Return codes:
sSuccess - The texture transformations were applied. statusCode AlTexture::applyIteratorToTextures( AlIterator *iter, int &rc )
Description
Apply the given AlIterator to all textures in the texture. 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.
Arguments
< iter - a pointer to the iterator Return codes
sSuccess - the application of the iterator terminated normally