# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CTextureBlend Class Reference

This is a helper texture that helps to blend between 2 others textures. More...

#include <texture_blend.h>

Inheritance diagram for NL3D::CTextureBlend:

NL3D::ITexture NLMISC::CBitmap NLMISC::CRefCount NLMISC::IStreamable NLMISC::IClassable List of all members.

Public Methods

 NLMISC_DECLARE_CLASS (CTextureBlend)
 CTextureBlend ()
 ctor. More...

void setBlendTexture (uint index, ITexture *tex)
 Set one of the textures between which to blend. If set to NULL, the result texture will be a dummy texture. More...

ITexturegetBlendtexture (uint index)
 Get a blend texture. More...

const ITexturegetBlendtexture (uint index) const
bool setBlendFactor (uint16 factor)
 Set the blend factor between textures. More...

uint16 getBlendFactor () const
 Get the blend factor between the textures (from 0 to 255). More...

virtual void doGenerate ()
 Generate this texture data's. More...

virtual void release ()
 release this texture datas. More...

virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 serial ITexture basic infos (clamp ...). More...

Texture sharing
virtual bool supportSharing () const
 Does this texture support sharing system. More...

virtual std::string getShareName () const
 Return the Unique ident/name of the texture, used for Driver sharing caps. More...

void enableSharing (bool enabled=false)
 enable / disable sharing support. More...

bool isSharingEnabled () const
 test whether texture sharing is enabled. More...


Private Attributes

uint16 _BlendFactor
NLMISC::CSmartPtr< ITexture_BlendTex [2]
bool _SharingEnabled

Detailed Description

This is a helper texture that helps to blend between 2 others textures.

It may help where sharing is needed. (for example, with a texture that blend between day / night, and that is shared by several object). The default is to have sharing enabled. NB : sharing is only supported if the 2 blending textures support sharing IMPORTANT: you should setup all your blend texture after changing the blend factor to avoid previous texture to be left in VRAM

Author:
Nicolas Vizerie , Nevrax France
Date:
2001

Definition at line 47 of file texture_blend.h.


Constructor & Destructor Documentation

NL3D::CTextureBlend::CTextureBlend  
 

ctor.

Definition at line 35 of file texture_blend.cpp.


Member Function Documentation

void NL3D::CTextureBlend::doGenerate   [virtual]
 

Generate this texture data's.

Implements NL3D::ITexture.

Definition at line 102 of file texture_blend.cpp.

References _BlendFactor, _BlendTex, NLMISC::CBitmap::blend, and NLMISC::CBitmap::makeDummy.

void NL3D::CTextureBlend::enableSharing bool    enabled = false
 

enable / disable sharing support.

Definition at line 61 of file texture_blend.cpp.

References _SharingEnabled.

uint16 NL3D::CTextureBlend::getBlendFactor   const [inline]
 

Get the blend factor between the textures (from 0 to 255).

Definition at line 67 of file texture_blend.h.

References _BlendFactor.

const ITexture* NL3D::CTextureBlend::getBlendtexture uint    index const [inline]
 

Definition at line 59 of file texture_blend.h.

References _BlendTex, index, NL3D::ITexture::ITexture, and nlassert.

ITexture* NL3D::CTextureBlend::getBlendtexture uint    index [inline]
 

Get a blend texture.

Definition at line 58 of file texture_blend.h.

References _BlendTex, index, NL3D::ITexture::ITexture, and nlassert.

std::string NL3D::CTextureBlend::getShareName   const [virtual]
 

Return the Unique ident/name of the texture, used for Driver sharing caps.

Deriver should add a prefix for their texture type. eg "file::pipoland", "noise::4-4-2" etc....

Reimplemented from NL3D::ITexture.

Definition at line 48 of file texture_blend.cpp.

References _BlendFactor, _BlendTex, nlassert, NLMISC::smprintf, and supportSharing.

bool NL3D::CTextureBlend::isSharingEnabled   const [inline]
 

test whether texture sharing is enabled.

Definition at line 76 of file texture_blend.h.

References _SharingEnabled.

NL3D::CTextureBlend::NLMISC_DECLARE_CLASS CTextureBlend   
 

void NL3D::CTextureBlend::release   [virtual]
 

release this texture datas.

Reimplemented from NL3D::ITexture.

Definition at line 68 of file texture_blend.cpp.

References _BlendTex.

void NL3D::CTextureBlend::serial NLMISC::IStream   f throw (NLMISC::EStream) [virtual]
 

serial ITexture basic infos (clamp ...).

Reimplemented from NL3D::ITexture.

Definition at line 117 of file texture_blend.cpp.

bool NL3D::CTextureBlend::setBlendFactor uint16    factor
 

Set the blend factor between textures.

It must range from 0 to 256.

Returns:
true if the texture has been touched

Definition at line 76 of file texture_blend.cpp.

References _BlendFactor, nlassert, and NL3D::ITexture::touch.

void NL3D::CTextureBlend::setBlendTexture uint    index,
ITexture   tex
 

Set one of the textures between which to blend. If set to NULL, the result texture will be a dummy texture.

Definition at line 90 of file texture_blend.cpp.

References _BlendTex, index, nlassert, and NL3D::ITexture::touch.

bool NL3D::CTextureBlend::supportSharing   const [virtual]
 

Does this texture support sharing system.

Reimplemented from NL3D::ITexture.

Definition at line 41 of file texture_blend.cpp.

References _BlendTex.

Referenced by getShareName.


Member Data Documentation

uint16 NL3D::CTextureBlend::_BlendFactor [private]
 

Definition at line 89 of file texture_blend.h.

Referenced by doGenerate, getBlendFactor, getShareName, and setBlendFactor.

NLMISC::CSmartPtr<ITexture> NL3D::CTextureBlend::_BlendTex[2] [private]
 

Definition at line 90 of file texture_blend.h.

Referenced by doGenerate, getBlendtexture, getShareName, release, setBlendTexture, and supportSharing.

bool NL3D::CTextureBlend::_SharingEnabled [private]
 

Definition at line 91 of file texture_blend.h.

Referenced by enableSharing, and isSharingEnabled.


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