csProcTexture Class Reference
Generic superclass for procedural textures. More...
#include <cstool/proctex.h>
Inheritance diagram for csProcTexture:
Public Member Functions | |
virtual void | Animate (csTicks current_time)=0 |
Animate this texture. | |
void | DisableAutoUpdate () |
Disable auto-update. | |
virtual void | GetDimension (int &w, int &h) const |
get dimension | |
iGraphics2D * | GetG2D () |
iGraphics3D * | GetG3D () |
iTextureWrapper * | GetTextureWrapper () |
Get the texture corresponding with this procedural texture. | |
iMaterialWrapper * | Initialize (iObjectRegistry *object_reg, iEngine *engine, iTextureManager *txtmgr, const char *name) |
Initialize this procedural texture, create a material associated with it, properly register the texture and material and prepare them. | |
virtual bool | Initialize (iObjectRegistry *object_reg) |
Do everything needed to initialize this texture. | |
virtual bool | PrepareAnim () |
Prepare the animation for use. | |
void | SetKeyColor (int red, int green, int blue) |
Set the key color to use for this texture. | |
Static Public Member Functions | |
static int | GetRandom (int max) |
Public Attributes | |
csTicks | last_cur_time |
Protected Member Functions | |
virtual iTextureWrapper * | Clone () const |
Create a clone this texture wrapper, using the same texture handle. | |
virtual bool | GetAlwaysAnimate () const |
Get the 'always animate' flag. | |
virtual iTextureFactory * | GetFactory () |
Returns the texturefactor that created this proctexture. | |
virtual int | GetFlags () const |
Return the flags which are used to register the texture. | |
virtual iImage * | GetImageFile () |
Get the iImage. | |
virtual void | GetKeyColor (int &red, int &green, int &blue) const |
Query the transparent color. | |
virtual const char * | GetTextureClass () |
Get the "class" of this texture. | |
virtual iTextureHandle * | GetTextureHandle () |
Get the texture handle. | |
virtual iTextureCallback * | GetUseCallback () const |
Get the use callback. | |
virtual bool | IsVisitRequired () const |
Return true if it is needed to call Visit(). | |
virtual bool | KeepImage () const |
If this flag is true then the image will be kept even after calling Register. | |
virtual iObject * | QueryObject () |
Get the iObject for this texture. | |
virtual void | Register (iTextureManager *txtmng) |
Register the texture with the texture manager. | |
virtual void | SetAlwaysAnimate (bool enable) |
Set the 'always animate' flag. | |
virtual void | SetFlags (int flags) |
Set the flags which are used to register the texture. | |
virtual void | SetImageFile (iImage *Image) |
Change the base iImage. | |
virtual void | SetKeepImage (bool k) |
Set the keep image flag. | |
virtual void | SetTextureClass (const char *className) |
Set the "class" of this texture. | |
virtual void | SetTextureHandle (iTextureHandle *tex) |
Change the texture handle. | |
virtual void | SetUseCallback (iTextureCallback *callback) |
Set a callback which is called just before the texture is used. | |
virtual void | Visit () |
Visit this texture. | |
Protected Attributes | |
bool | always_animate |
bool | anim_prepared |
csRef< iGraphics2D > | g2d |
csRef< iGraphics3D > | g3d |
int | key_blue |
bool | key_color |
int | key_green |
int | key_red |
int | mat_h |
int | mat_w |
iObjectRegistry * | object_reg |
csRef< iImage > | proc_image |
bool | ptReady |
iTextureWrapper * | tex |
int | texFlags |
bool | use_cb |
bool | visible |
Friends | |
struct | csProcTexCallback |
class | csProcTexEventHandler |
Detailed Description
Generic superclass for procedural textures.This class takes care of scheduling when a procedural texture needs updating.
Definition at line 61 of file proctex.h.
Member Function Documentation
virtual void csProcTexture::Animate | ( | csTicks | current_time | ) | [pure virtual] |
Animate this texture.
Subclasses of csProcTexture must implement this to implement some kind of animation on the procedural texture.
Implemented in csProcAnimated.
virtual iTextureWrapper* csProcTexture::Clone | ( | ) | const [protected, virtual] |
void csProcTexture::DisableAutoUpdate | ( | ) | [inline] |
Disable auto-update.
By default csProcTexture will register a callback so that every time the texture is visible Animate will automatically be called. If you don't want this and you want to call Animate on your own then you can disable this feature. You need to call DisableAutoUpdate() before calling Initialize().
virtual bool csProcTexture::GetAlwaysAnimate | ( | ) | const [protected, virtual] |
virtual void csProcTexture::GetDimension | ( | int & | w, | |
int & | h | |||
) | const [inline, virtual] |
virtual iTextureFactory* csProcTexture::GetFactory | ( | ) | [protected, virtual] |
virtual int csProcTexture::GetFlags | ( | ) | const [protected, virtual] |
virtual iImage* csProcTexture::GetImageFile | ( | ) | [protected, virtual] |
virtual void csProcTexture::GetKeyColor | ( | int & | red, | |
int & | green, | |||
int & | blue | |||
) | const [protected, virtual] |
virtual const char* csProcTexture::GetTextureClass | ( | ) | [protected, virtual] |
Get the "class" of this texture.
For more information, see iTextureHandle::GetTextureClass.
Implements iTextureWrapper.
virtual iTextureHandle* csProcTexture::GetTextureHandle | ( | ) | [protected, virtual] |
iTextureWrapper* csProcTexture::GetTextureWrapper | ( | ) | [inline] |
virtual iTextureCallback* csProcTexture::GetUseCallback | ( | ) | const [protected, virtual] |
Get the use callback.
If there are multiple use callbacks you can use this function to chain.
Implements iTextureWrapper.
iMaterialWrapper* csProcTexture::Initialize | ( | iObjectRegistry * | object_reg, | |
iEngine * | engine, | |||
iTextureManager * | txtmgr, | |||
const char * | name | |||
) |
Initialize this procedural texture, create a material associated with it, properly register the texture and material and prepare them.
This function assumes that the texture manager has already been set up. It is a convenience function that offers less flexibility but is sufficient for most cases. The texture and material will get the name that is given by this routine.
virtual bool csProcTexture::Initialize | ( | iObjectRegistry * | object_reg | ) | [virtual] |
Do everything needed to initialize this texture.
At this stage only will settings like the key color be used. The correct init sequence is:
Alternatively you can use Initialize(engine,name) which does all this work for you.
virtual bool csProcTexture::IsVisitRequired | ( | ) | const [protected, virtual] |
virtual bool csProcTexture::KeepImage | ( | ) | const [protected, virtual] |
If this flag is true then the image will be kept even after calling Register.
If this flag is false then Register() will remove the image pointer from this texture wrapper. False by default.
Implements iTextureWrapper.
virtual bool csProcTexture::PrepareAnim | ( | ) | [virtual] |
virtual iObject* csProcTexture::QueryObject | ( | ) | [protected, virtual] |
virtual void csProcTexture::Register | ( | iTextureManager * | txtmng | ) | [protected, virtual] |
virtual void csProcTexture::SetAlwaysAnimate | ( | bool | enable | ) | [protected, virtual] |
virtual void csProcTexture::SetFlags | ( | int | flags | ) | [protected, virtual] |
virtual void csProcTexture::SetImageFile | ( | iImage * | Image | ) | [protected, virtual] |
Change the base iImage.
The changes will not be visible until the texture is registered again.
Implements iTextureWrapper.
virtual void csProcTexture::SetKeepImage | ( | bool | k | ) | [protected, virtual] |
void csProcTexture::SetKeyColor | ( | int | red, | |
int | green, | |||
int | blue | |||
) | [inline, virtual] |
virtual void csProcTexture::SetTextureClass | ( | const char * | className | ) | [protected, virtual] |
Set the "class" of this texture.
For more information, see iTextureHandle::SetTextureClass.
Implements iTextureWrapper.
virtual void csProcTexture::SetTextureHandle | ( | iTextureHandle * | tex | ) | [protected, virtual] |
Change the texture handle.
The changes will immediatly be visible. This will also change the key color and registration flags to those of the new texture and the iImage to 0.
Implements iTextureWrapper.
virtual void csProcTexture::SetUseCallback | ( | iTextureCallback * | callback | ) | [protected, virtual] |
Set a callback which is called just before the texture is used.
This is mainly useful for procedural textures which can then choose to update their image.
Implements iTextureWrapper.
virtual void csProcTexture::Visit | ( | ) | [protected, virtual] |
Visit this texture.
This should be called by the engine right before using the texture. It is responsible for calling the use callback if there is one.
Implements iTextureWrapper.
The documentation for this class was generated from the following file:
- cstool/proctex.h
Generated for Crystal Space by doxygen 1.4.7