|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NL3D::ITexture Class ReferenceInterface for textures.
More...
#include <texture.h>
Inheritance diagram for NL3D::ITexture:
List of all members.
Public Types |
enum | TWrapMode { Repeat = 0,
Clamp,
WrapModeCount
} |
enum | TUploadFormat {
Auto = 0,
RGBA8888,
RGBA4444,
RGBA5551,
RGB888,
RGB565,
DXTC1,
DXTC1Alpha,
DXTC3,
DXTC5,
Luminance,
Alpha,
AlphaLuminance,
DsDt,
UploadFormatCount
} |
enum | TMagFilter { Nearest = 0,
Linear,
MagFilterCount
} |
| Magnification mode. More...
|
enum | TMinFilter {
NearestMipMapOff = 0,
NearestMipMapNearest,
NearestMipMapLinear,
LinearMipMapOff,
LinearMipMapNearest,
LinearMipMapLinear,
MinFilterCount
} |
| Minifying mode. More...
|
Public Methods |
void | touch () |
| This method invalidates all the texture surface. More...
|
void | touchRect (const NLMISC::CRect &rect) |
| This method invalidates a rectangle of the texture surface. More...
|
bool | getReleasable () const |
| Return whether texture can be released. More...
|
void | setReleasable (bool r) |
| Set if texture can be released If it is true, the driver will release the texture after generating it and upload it into the videomemory by calling release(). More...
|
void | generate () |
| Generate the texture pixels. More...
|
void | validateGenerateFlag () |
| Advanced. More...
|
virtual void | release () |
| Release the texure (free memory). More...
|
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...
|
bool | setupedIntoDriver () const |
| Tells if the texture has been setuped by the driver. More...
|
void | releaseDriverSetup () |
| Release the Driver info for this texture (if any). Call it with care. More...
|
virtual bool | allowDegradation () const |
| Does this texture allow the driver to degrade. More...
|
virtual void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
| serial ITexture basic infos (clamp ...). More...
|
virtual void | selectTexture (uint index) |
| Select a texture among several other (if this texture is a set of texture such as CTextureMultiFile) The default does nothing. More...
|
virtual bool | isSelectable () const |
| Test wether this texture is selectable. More...
|
virtual ITexture * | buildNonSelectableVersion (uint index) |
| If this texture is selectable, build a non selectable version of this texture that is setupped with the given slot. More...
|
bool | isAllInvalidated () const |
| Return true if ALL the texture is invalidate, else return false. More...
|
bool | touched (void) |
| This method return the touched flag. More...
|
void | clearTouched (void) |
|
| ITexture () |
| By default, a texture is releasable. More...
|
| ITexture (const ITexture &tex) |
| see operator=. More...
|
virtual | ~ITexture () |
| Need a virtual dtor. More...
|
ITexture & | operator= (const ITexture &tex) |
| The operator= do not copy drv info, and set touched=true. _Releasable, WrapMode and UploadFormat are copied. More...
|
|
void | setWrapS (TWrapMode mode) |
void | setWrapT (TWrapMode mode) |
TWrapMode | getWrapS () const |
TWrapMode | getWrapT () const |
void | setUploadFormat (TUploadFormat pf) |
| Replace the uploaded format of the texture. More...
|
TUploadFormat | getUploadFormat () const |
virtual void | setFilterMode (TMagFilter magf, TMinFilter minf) |
TMagFilter | getMagFilter () const |
TMinFilter | getMinFilter () const |
bool | mipMapOff () const |
bool | mipMapOn () const |
|
virtual bool | isTextureCube () const |
| Does this texture is a cube texture. More...
|
Public Attributes |
NLMISC::CRefPtr< CTextureDrvShare > | TextureDrvShare |
std::list< NLMISC::CRect > | _ListInvalidRect |
| List of invalided rectangle. More...
|
Protected Methods |
virtual void | doGenerate ()=0 |
| Generate the texture pixels. More...
|
Protected Attributes |
bool | _Touched |
Private Attributes |
bool | _GoodGenerate |
bool | _Releasable |
TUploadFormat | _UploadFormat |
TWrapMode | _WrapS |
TWrapMode | _WrapT |
TMinFilter | _MinFilter |
TMagFilter | _MagFilter |
Detailed Description
Interface for textures.
Sharing System note: The deriver may implement sharing system by implement supportSharing() and getShareName(). Such a texture may return a Unique Name for sharing. If the driver already has this texture, it will reuse it. As a direct impact, you cannot invalidate part of the textures with shared texture. This is logic, since the Unique sharname of the texture must represent all of it.
Definition at line 104 of file texture.h.
Member Enumeration Documentation
enum NL3D::ITexture::TMagFilter
|
|
|
Magnification mode.
Same behavior as OpenGL. -
Enumeration values:
-
Nearest |
|
Linear |
|
MagFilterCount |
|
Definition at line 140 of file texture.h.
Referenced by getMagFilter. |
enum NL3D::ITexture::TMinFilter
|
|
|
Minifying mode.
Same behavior as OpenGL. If the bitmap has no mipmap, and mipmap is required, then mipmaps are computed. -
Enumeration values:
-
NearestMipMapOff |
|
NearestMipMapNearest |
|
NearestMipMapLinear |
|
LinearMipMapOff |
|
LinearMipMapNearest |
|
LinearMipMapLinear |
|
MinFilterCount |
|
Definition at line 151 of file texture.h.
Referenced by getMinFilter. |
enum NL3D::ITexture::TUploadFormat
|
|
|
-
Enumeration values:
-
Auto |
|
RGBA8888 |
|
RGBA4444 |
|
RGBA5551 |
|
RGB888 |
|
RGB565 |
|
DXTC1 |
|
DXTC1Alpha |
|
DXTC3 |
|
DXTC5 |
|
Luminance |
|
Alpha |
|
AlphaLuminance |
|
DsDt |
|
UploadFormatCount |
|
Definition at line 117 of file texture.h.
Referenced by getUploadFormat. |
enum NL3D::ITexture::TWrapMode
|
|
Constructor & Destructor Documentation
NL3D::ITexture::ITexture |
( |
|
) |
|
|
|
By default, a texture is releasable.
Definition at line 43 of file texture.cpp.
References _GoodGenerate, _MagFilter, _MinFilter, _Releasable, _Touched, _UploadFormat, _WrapS, _WrapT, Auto, Linear, LinearMipMapLinear, and Repeat.
Referenced by NL3D::CTextureMultiFile::buildNonSelectableVersion, NL3D::CTextureCube::buildNonSelectableVersion, buildNonSelectableVersion, NL3D::CTextureCube::doGenerate, NL3D::CTextureBlend::getBlendtexture, NL3D::CTextureBump::getHeightMap, NL3D::CTextureCube::getTexture, and NL3D::CTextureFile::operator=. |
NL3D::ITexture::ITexture |
( |
const ITexture & |
tex |
) |
[inline] |
|
NL3D::ITexture::~ITexture |
( |
|
) |
[virtual] |
|
Member Function Documentation
virtual bool NL3D::ITexture::allowDegradation |
( |
|
) |
const [inline, virtual] |
|
virtual ITexture* NL3D::ITexture::buildNonSelectableVersion |
( |
uint |
index |
) |
[inline, virtual] |
|
|
If this texture is selectable, build a non selectable version of this texture that is setupped with the given slot.
NB : If this texture is selectable, you are ensured that the return pointer is not 'this'
Reimplemented in NL3D::CTextureCube.
Definition at line 354 of file texture.h.
References index, and ITexture. |
void NL3D::ITexture::clearTouched |
( |
void |
|
) |
[inline] |
|
virtual void NL3D::ITexture::doGenerate |
( |
|
) |
[protected, pure virtual] |
|
|
Generate the texture pixels.
If the invalidate rect list is empty, generate() must rebuild all the texture. If the invalidate rect list is not empty, generate() rebuilds only the invalidate rectangles in the list.
-
See also:
-
isAllInvalidated(), touch(), touched(), touchRect(), clearTouched(), _ListInvalidRect, generate() , getReleasable(), setReleasable()
Implemented in NL3D::CTextureCross.
Referenced by generate. |
void NL3D::ITexture::generate |
( |
|
) |
[inline] |
|
|
Generate the texture pixels.
This method is called by the driver when it needs to generate pixels of the texture. If the texture is used for the first time or if it is touched, the driver will call this method. For exemple, a texture file will load the bitmap in this method.
If the invalidate rect list is empty, generate() rebuild all the texture. If the invalidate rect list is not empty, generate() rebuilds only the invalidate rectangles in the list.
Don't clear the touch flag or the invalid rectangle list until updating the texture in generate(). It's the generate()'s caller jobs.
After generation, if the texture is releasable, the driver will release the texture by calling release().
NB: a flag is maintained to see if the generated bitmap is coherent with texture description (see touch*()). So if you do {generate(); generate();}, you only get 1 real bitmap generation...
-
See also:
-
isAllInvalidated(), touch(), touched(), touchRect(), clearTouched(), _ListInvalidRect , getReleasable(), setReleasable()
Definition at line 295 of file texture.h.
References _GoodGenerate, and doGenerate. |
TMagFilter NL3D::ITexture::getMagFilter |
( |
|
) |
const [inline] |
|
TMinFilter NL3D::ITexture::getMinFilter |
( |
|
) |
const [inline] |
|
bool NL3D::ITexture::getReleasable |
( |
|
) |
const [inline] |
|
|
Return whether texture can be released.
If it returns true, the driver will release the texture after generate it and upload it into the videomemory by calling release(). If it returns false, the driver won't release the texture.
-
Returns:
-
true if texture can be released, false else
-
See also:
-
setReleasable(), generate()
Definition at line 259 of file texture.h.
References _Releasable. |
virtual std::string NL3D::ITexture::getShareName |
( |
|
) |
const [inline, 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 in NL3D::CTextureBlend.
Definition at line 324 of file texture.h. |
TWrapMode NL3D::ITexture::getWrapS |
( |
|
) |
const [inline] |
|
TWrapMode NL3D::ITexture::getWrapT |
( |
|
) |
const [inline] |
|
bool NL3D::ITexture::isAllInvalidated |
( |
|
) |
const [inline] |
|
|
Return true if ALL the texture is invalidate, else return false.
Definition at line 410 of file texture.h.
References _Touched.
Referenced by touchRect. |
virtual bool NL3D::ITexture::isSelectable |
( |
|
) |
const [inline, virtual] |
|
virtual bool NL3D::ITexture::isTextureCube |
( |
|
) |
const [inline, virtual] |
|
bool NL3D::ITexture::mipMapOff |
( |
|
) |
const [inline] |
|
bool NL3D::ITexture::mipMapOn |
( |
|
) |
const [inline] |
|
ITexture & NL3D::ITexture::operator= |
( |
const ITexture & |
tex |
) |
|
|
virtual void NL3D::ITexture::release |
( |
void |
|
) |
[inline, virtual] |
|
void NL3D::ITexture::releaseDriverSetup |
( |
|
) |
|
|
virtual void NL3D::ITexture::selectTexture |
( |
uint |
index |
) |
[inline, virtual] |
|
void NL3D::ITexture::setReleasable |
( |
bool |
r |
) |
[inline] |
|
bool NL3D::ITexture::setupedIntoDriver |
( |
|
) |
const [inline] |
|
|
Replace the uploaded format of the texture.
If "Auto", the driver use CBitmap::getPixelFormat() to find the best associated pixelFormat. When no alpha is wanted (RGB, Luminance....), texture default output is 1.0. For "Alpha" mode, RGB output is (0,0,0).
Definition at line 88 of file texture.cpp.
References _UploadFormat, and touch.
Referenced by NL3D::CTextureDLM::CTextureDLM, NL3D::CTextureFont::CTextureFont, NL3D::CTextureNear::CTextureNear, and NL3D::CTextureFar::setSizeOfFarPatch. |
void NL3D::ITexture::setWrapS |
( |
TWrapMode |
mode |
) |
[inline] |
|
void NL3D::ITexture::setWrapT |
( |
TWrapMode |
mode |
) |
[inline] |
|
virtual bool NL3D::ITexture::supportSharing |
( |
|
) |
const [inline, virtual] |
|
void NL3D::ITexture::touch |
( |
|
) |
[inline] |
|
|
This method invalidates all the texture surface.
When the driver calls generate, the texture will rebuild all the texture and the driver will update it.
-
See also:
-
isAllInvalidated(), generate(), touchRect(), touched(), _ListInvalidRect
Definition at line 219 of file texture.h.
References _GoodGenerate, _ListInvalidRect, and _Touched.
Referenced by NL3D::CTextureFile::CTextureFile, operator=, NL3D::CTextureMultiFile::selectTexture, NL3D::CTextureCube::selectTexture, NL3D::CTextureBlend::setBlendFactor, NL3D::CTextureBlend::setBlendTexture, NL3D::CTextureMultiFile::setFileName, NL3D::CTextureFile::setFileName, setFilterMode, NL3D::CTextureBump::setHeightMap, NL3D::CTextureGrouped::setTextures, and setUploadFormat. |
bool NL3D::ITexture::touched |
( |
void |
|
) |
[inline] |
|
void NL3D::ITexture::touchRect |
( |
const NLMISC::CRect & |
rect |
) |
[inline] |
|
|
This method invalidates a rectangle of the texture surface.
When the driver calls generate, the texture could rebuild only this part of texture and the driver will update only those rectangles.
This method is incompatible with textures which support sharing (see class description).
-
See also:
-
isAllInvalidated(), generate(), touch(), touched(), _ListInvalidRect
Definition at line 234 of file texture.h.
References _GoodGenerate, _ListInvalidRect, _Touched, isAllInvalidated, nlassert, and supportSharing.
Referenced by NL3D::CTextureFont::getLetterInfo. |
void NL3D::ITexture::validateGenerateFlag |
( |
|
) |
[inline] |
|
Member Data Documentation
bool NL3D::ITexture::_GoodGenerate [private]
|
|
bool NL3D::ITexture::_Releasable [private]
|
|
bool NL3D::ITexture::_Touched [protected]
|
|
The documentation for this class was generated from the following files:
|
|