ygTexture derived from ygGeometry Example Source Header

Description: load a texture and place it on a polygon

notes:
Category: Geometry
Author: Alex Hill
11/01/01
10/15/02 Dave Pape - add optional cache flag to "file" msg, "reload" message, and included cache-state in netFilename
09/01/04 Alex Hill - derived from ygGeometry class and added functionality to create a parent ygTransform when necessary
Revision: 06/28/05 Alex Hill - fixed several bugs related to performance with the material node

    Messages
file file, [bool] load the given texture file with optional caching
cache bool set the default object caching mode
reload reload the currently loaded object
showLocal [bool] set whether the object is drawn locally
position create a parent ygTransform and pass the message
orientation create a parent ygTransform and pass the message
size create a parent ygTransform and pass the message
updateInterval create a parent ygTransform and pass the message
reliableKey create a parent ygTransform and pass the message
    Comments

constructor ygTexture

1 create texture polygon

destructor ~ygTexture

method reset

1 set cache to true

method message

1 load the given texture file with optional caching
2 set the default object caching mode
3 reload the currently loaded object
4 set whether the object is drawn locally
5 create a parent ygTransform and pass the message

method setTexture

1 if cache mode is true then retrieve from texture cache
2 else, load the file using loadFile
2.1 get number of image components
2.2 if alpha channel then set transparency
2.3 set intersection traversal mask

method createGeometry

1 create a new pfGeode and add it to the scene
2 allocate (from shared memory) an array of vertices for the polygon
3 create an array of normals for the polygon
4 create an array of texture coordinates for the polygon
5 create the geometry set and add the geometry data to it
6 Create a new material
7 Create a pfGeostate, add the material, and then assign it to our geometry

method createTransform

method createDebugNode