CrystalSpace

Public API Reference

csProcTexture Class Reference

Generic superclass for procedural textures. More...

#include <cstool/proctex.h>

Inheritance diagram for csProcTexture:

Inheritance graph
[legend]
List of all members.

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
iGraphics2DGetG2D ()
iGraphics3DGetG3D ()
iTextureWrapperGetTextureWrapper ()
 Get the texture corresponding with this procedural texture.
iMaterialWrapperInitialize (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 iTextureWrapperClone () const
 Create a clone this texture wrapper, using the same texture handle.
virtual bool GetAlwaysAnimate () const
 Get the 'always animate' flag.
virtual iTextureFactoryGetFactory ()
 Returns the texturefactor that created this proctexture.
virtual int GetFlags () const
 Return the flags which are used to register the texture.
virtual iImageGetImageFile ()
 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 iTextureHandleGetTextureHandle ()
 Get the texture handle.
virtual iTextureCallbackGetUseCallback () 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 iObjectQueryObject ()
 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< iGraphics2Dg2d
csRef< iGraphics3Dg3d
int key_blue
bool key_color
int key_green
int key_red
int mat_h
int mat_w
iObjectRegistryobject_reg
csRef< iImageproc_image
bool ptReady
iTextureWrappertex
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]

Create a clone this texture wrapper, using the same texture handle.

Implements iTextureWrapper.

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().

Definition at line 153 of file proctex.h.

virtual bool csProcTexture::GetAlwaysAnimate (  )  const [protected, virtual]

Get the 'always animate' flag.

Implements iProcTexture.

virtual void csProcTexture::GetDimension ( int &  w,
int &  h 
) const [inline, virtual]

get dimension

Definition at line 201 of file proctex.h.

virtual iTextureFactory* csProcTexture::GetFactory (  )  [protected, virtual]

Returns the texturefactor that created this proctexture.

Implements iProcTexture.

virtual int csProcTexture::GetFlags (  )  const [protected, virtual]

Return the flags which are used to register the texture.

Implements iTextureWrapper.

virtual iImage* csProcTexture::GetImageFile (  )  [protected, virtual]

Get the iImage.

Implements iTextureWrapper.

virtual void csProcTexture::GetKeyColor ( int &  red,
int &  green,
int &  blue 
) const [protected, virtual]

Query the transparent color.

Implements iTextureWrapper.

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]

Get the texture handle.

Implements iTextureWrapper.

iTextureWrapper* csProcTexture::GetTextureWrapper (  )  [inline]

Get the texture corresponding with this procedural texture.

Definition at line 210 of file proctex.h.

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]

Return true if it is needed to call Visit().

Implements iTextureWrapper.

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]

Prepare the animation for use.

Reimplemented in csProcAnimated.

virtual iObject* csProcTexture::QueryObject (  )  [protected, virtual]

Get the iObject for this texture.

Implements iTextureWrapper.

virtual void csProcTexture::Register ( iTextureManager txtmng  )  [protected, virtual]

Register the texture with the texture manager.

Implements iTextureWrapper.

virtual void csProcTexture::SetAlwaysAnimate ( bool  enable  )  [protected, virtual]

Set the 'always animate' flag.

Implements iProcTexture.

virtual void csProcTexture::SetFlags ( int  flags  )  [protected, virtual]

Set the flags which are used to register the texture.

Implements iTextureWrapper.

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]

Set the keep image flag.

See KeepImage() function for explanation.

Implements iTextureWrapper.

void csProcTexture::SetKeyColor ( int  red,
int  green,
int  blue 
) [inline, virtual]

Set the key color to use for this texture.

Implements iTextureWrapper.

Definition at line 185 of file proctex.h.

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:
Generated for Crystal Space by doxygen 1.4.7