LightWrap++
AC++wrapperfortheLightWave3DSDK
lwpp::Texture Class Reference

A Texture is a set of TextureLayer that drive a parameter. More...

#include <texture.h>

+ Inheritance diagram for lwpp::Texture:
+ Collaboration diagram for lwpp::Texture:

List of all members.

Public Member Functions

 Texture (LWTextureID _txtr_id=0)
 Constructor.
void cleanup ()
 You call this when the calculations for the texture are finished, after the last frame has been rendered for example.
LWTxtrContextID context (void)
 Returns the context of the texture. Is like the information of the first three parameter of the create function.
void contextAddParam (LWTxtrContextID lwtxtrcontextid, LWTxtrParamDesc pdesc)
 Add a parameter to the context.
LWTxtrContextID contextCreate (LWTxtrParamFuncs lwtxtparamfunc)
void contextDestroy (LWTxtrContextID lwtxtrcontextid)
 Free the resources allocated by the previous function contextCreate.
void copy (LWTextureID to, LWTextureID from)
 Copy a texture.
void create (int returntype, const char *name, LWTxtrContextID lwtxtrcontextid=0, void *userdata=0)
 Creates a Texture.
void destroy ()
 Destroy the texture created with create.
double evaluate (LWMicropolID lwmp, double *value)
 Evaluates the texture.
int getDataType ()
 Returns the type of value returned by the texture.
LWTextureID getID () const
 Returns the ID of the texture.
void load (const LWLoadState *loadstate)
 Read the texture from a file.
const char * name ()
 Returns name of the texture.
void newtime (LWTime time, LWFrame frame)
 This allows do any pre calculation needed, that can depend on time.
void save (const LWSaveState *savestate)
 Write the texture to a file.
void setEnvGroup (LWChanGroupID txtr_group_id)
 Creates a group that will contain the Envelopes created for parameters of the texture.
Layer Management

Access to the TextureLayer within the Texture

TextureLayer layerAdd (int type)
 Adds a new layer to the texture.
TextureLayer firstLayer ()
 Returns the ID of the first layer in the texture. This ID can be passed to functions the return the Layer data.
TextureLayer lastLayer ()
 Returns the ID of the last layer in the texture. This ID can be passed to functions the return the Layer data.
TextureLayer nextLayer (TextureLayer layer)
 Returns the ID of the next layer in the texture, this is the Layer ID of the layer after the ID passed as parameter.
LWTLayerID layerAddID (int type)
 Adds a new layer to the texture.
LWTLayerID firstLayerID ()
 Returns the ID of the first layer in the texture. This ID can be passed to functions the return the Layer data.
LWTLayerID lastLayerID ()
 Returns the ID of the last layer in the texture. This ID can be passed to functions the return the Layer data.
LWTLayerID nextLayerID (LWTLayerID lid)
 Returns the ID of the next layer in the texture, this is the Layer ID of the layer after the ID passed as parameter.

Protected Member Functions

bool _acquireGlobal ()
virtual bool available () const
 Check if the global is available.
virtual LWTextureFuncs * getGlobal ()
 Get the pointer to the global.
LWTextureFuncs * operator-> ()
 Get the pointer to the global.

Static Protected Attributes

static LWTextureFuncs * globPtr
 Pointer to the global functions.

Detailed Description

A Texture is a set of TextureLayer that drive a parameter.

Give access to the Texture engine to create Image, Gradient or Procedural Textures that can be used even for modulate parameters on plugins.


Constructor & Destructor Documentation

lwpp::Texture::Texture ( LWTextureID  _txtr_id = 0)
inline

Constructor.


Member Function Documentation

bool lwpp::GlobalBase< LWTextureFuncs >::_acquireGlobal ( )
inlineprotectedinherited
virtual bool lwpp::GlobalBase< LWTextureFuncs >::available ( ) const
inlinevirtualinherited

Check if the global is available.

void lwpp::Texture::cleanup ( )
inline

You call this when the calculations for the texture are finished, after the last frame has been rendered for example.

LWTxtrContextID lwpp::Texture::context ( void  )
inline

Returns the context of the texture. Is like the information of the first three parameter of the create function.

void lwpp::Texture::contextAddParam ( LWTxtrContextID  lwtxtrcontextid,
LWTxtrParamDesc  pdesc 
)
inline

Add a parameter to the context.

For Gradients this is the way to add an Input Parameter for them. The added parameter will appear on the list of Input Parameters for the Gradient.

Parameters:
lwtxtrcontextidThe context of the texture. You obtain this with the previous function contextCreate.
LWTxtrContextID lwpp::Texture::contextCreate ( LWTxtrParamFuncs  lwtxtparamfunc)
inline

The texture context is used to populate and support the Input Parameter menu for gradient layers in the Texture Editor. This function creates a texture context. The Texture Editor uses the callbacks in the paramfuncs argument to get the value of the parameters.

Parameters:
lwtxtparamfuncA LWTxtrParamFuncs structure that contains the callback to input parameters for the texture.

LWTxtrParamFuncs has the members: double (*paramEvaluate)(LWTxtrParamDesc *pdesc, int paramnum, LWMicropol *lwmicropol, gParamData userdata); Returns the value of the parameter. pdesc is a description that you pass to contextAddParam. paramnum is the index order in wich the parameter was created. 0 is reserved for Previous Layer, so your Input Parameters will start as 1, 2, etc... In the order you created them lwmicropol is a micropolygon passed to the texture userdata is your own data returned from your paramTime callback gParamData (*paramTime)(void *userdata, LWTxtrParamDesc *pdesc, int paramnum, LWTime time, LWFrame frame); An initialization function for the parameter. Is called before paramEvaluate to realize pre calculations for it. userdata is your own data returned from your userdata function paramnum is the index order in wich the parameter was created. 0 is reserved for Previous Layer, so your Input Parameters will start as 1, 2, etc... In the order you created them time is the time in seconds frame is the time in frames void (*paramCleanup) (LWTxtrParamDesc *, int paramnum, gParamData userdata); Frees any resources allocated in paramTime pdesc is a description that you pass to contextAddParam. paramnum is the index order in wich the parameter was created. 0 is reserved for Previous Layer, so your Input Parameters will start as 1, 2, etc... In the order you created them userdata is your own data returned with userdata function

void lwpp::Texture::contextDestroy ( LWTxtrContextID  lwtxtrcontextid)
inline

Free the resources allocated by the previous function contextCreate.

The context may only be destroyed if all the textures using it has been destroyed first.

Parameters:
lwtxtrcontextidThe context of the texture. You obtain this with the previous function contextCreate.
void lwpp::Texture::copy ( LWTextureID  to,
LWTextureID  from 
)
inline

Copy a texture.

Parameters:
toID of the destiny texture TO copy
fromID of the source texture to copy from
void lwpp::Texture::create ( int  returntype,
const char *  name,
LWTxtrContextID  lwtxtrcontextid = 0,
void *  userdata = 0 
)
inline

Creates a Texture.

will appear on the list of Input Parameters for the Gradient.

Parameters:
returntypeIs the type of value returned by the texture. It can be TRT_VECTOR, TRT_COLOR, TRT_PERCENT, TRT_SCALAR, TRT_DISPLACEMENT
nameThis is the name of the texture that will appear on the Interface.
lwtxtrcontextidThe id of the texture. It can contain one or more texture layers. You obtain this with the previous function contextCreate. Pass NULL if you do not want to create any Input Parameter.
userdatais your own data returned with userdata function
void lwpp::Texture::destroy ( )
inline

Destroy the texture created with create.

double lwpp::Texture::evaluate ( LWMicropolID  lwmp,
double *  value 
)
inline

Evaluates the texture.

The double value returned is the alpha of the texture.

Parameters:
lwmpis a LWMicropol structure that must be initializated.
valueis where the resulting value of the texture is returned.
TextureLayer lwpp::Texture::firstLayer ( )

Returns the ID of the first layer in the texture. This ID can be passed to functions the return the Layer data.

LWTLayerID lwpp::Texture::firstLayerID ( )
inline

Returns the ID of the first layer in the texture. This ID can be passed to functions the return the Layer data.

int lwpp::Texture::getDataType ( )
inline

Returns the type of value returned by the texture.

Returns:
the type of value returned by the texture. It can be TRT_VECTOR, TRT_COLOR, TRT_PERCENT, TRT_SCALAR, TRT_DISPLACEMENT
virtual LWTextureFuncs * lwpp::GlobalBase< LWTextureFuncs >::getGlobal ( )
inlinevirtualinherited

Get the pointer to the global.

LWTextureID lwpp::Texture::getID ( void  ) const
inline

Returns the ID of the texture.

TextureLayer lwpp::Texture::lastLayer ( )

Returns the ID of the last layer in the texture. This ID can be passed to functions the return the Layer data.

LWTLayerID lwpp::Texture::lastLayerID ( )
inline

Returns the ID of the last layer in the texture. This ID can be passed to functions the return the Layer data.

TextureLayer lwpp::Texture::layerAdd ( int  type)

Adds a new layer to the texture.

Parameters:
typeIs the type of Layer to create. Can be TLT_IMAGE (Image Layer), TLT_PROC (Procedural Layer), TLT_GRAD (Gradient Layer)
LWTLayerID lwpp::Texture::layerAddID ( int  type)
inline

Adds a new layer to the texture.

Parameters:
typeIs the type of Layer to create. Can be TLT_IMAGE (Image Layer), TLT_PROC (Procedural Layer), TLT_GRAD (Gradient Layer)
void lwpp::Texture::load ( const LWLoadState *  loadstate)
inline

Read the texture from a file.

const char* lwpp::Texture::name ( )
inline

Returns name of the texture.

void lwpp::Texture::newtime ( LWTime  time,
LWFrame  frame 
)
inline

This allows do any pre calculation needed, that can depend on time.

Parameters:
timeis the time in seconds.
frameis the time in frames.
TextureLayer lwpp::Texture::nextLayer ( TextureLayer  layer)

Returns the ID of the next layer in the texture, this is the Layer ID of the layer after the ID passed as parameter.

This ID can be passed to functions the return the Layer data.

LWTLayerID lwpp::Texture::nextLayerID ( LWTLayerID  lid)
inline

Returns the ID of the next layer in the texture, this is the Layer ID of the layer after the ID passed as parameter.

This ID can be passed to functions the return the Layer data.

LWTextureFuncs * lwpp::GlobalBase< LWTextureFuncs >::operator-> ( )
inlineinherited

Get the pointer to the global.

void lwpp::Texture::save ( const LWSaveState *  savestate)
inline

Write the texture to a file.

void lwpp::Texture::setEnvGroup ( LWChanGroupID  txtr_group_id)

Creates a group that will contain the Envelopes created for parameters of the texture.

Parameters:
txtr_group_idA LWChanGroupID of the envelopes group.

Member Data Documentation

LWTextureFuncs * lwpp::GlobalBase< LWTextureFuncs >::globPtr
staticprotectedinherited

Pointer to the global functions.


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