OGRE-Next  2.3
Object-Oriented Graphics Rendering Engine
Ogre::OGRE_HLMS_TEXTURE_BASE_CLASS Class Reference

This is not a regular header, therefore it has no include guards. More...

#include <OgreHlmsTextureBaseClass.h>

+ Inheritance diagram for Ogre::OGRE_HLMS_TEXTURE_BASE_CLASS:

Public Types

enum  Reason {
  Unknown , FromStorageToSysRam , FromSysRamToStorage , GainedResidency ,
  LostResidency , PoolTextureSlotChanged , ResidentToSysRamSync , MetadataCacheOutOfDate ,
  ExceptionThrown , FsaaSettingAlteredByApi , ReadyForRendering , Deleted
}
 

Public Member Functions

 OGRE_HLMS_TEXTURE_BASE_CLASS (IdString name, Hlms *creator, const HlmsMacroblock *macroblock, const HlmsBlendblock *blendblock, const HlmsParamVec &params)
 
virtual ~OGRE_HLMS_TEXTURE_BASE_CLASS ()
 
void _linkRenderable (Renderable *renderable)
 
void _setSamplerblock (uint8 texType, const HlmsSamplerblock *samplerblockPtr)
 Same as setSamplerblock, but samplerblockPtr is a raw samplerblock retrieved from HlmsManager, and is assumed to have its reference count already be incremented for us. More...
 
void _setTexture (uint8 texType, TextureGpu *texture, const HlmsSamplerblock *samplerblockPtr=0, uint16 sliceIdx=std::numeric_limits< uint16 >::max())
 Same as setTexture, but samplerblockPtr is a raw samplerblock retrieved from HlmsManager, and is assumed to have its reference count already be incremented for us (note HlmsManager::getSamplerblock() already increments the ref. More...
 
void _unlinkRenderable (Renderable *renderable)
 
virtual void calculateHash ()
 Calculates the hashes needed for sorting by the RenderQueue (i.e. mTextureHash) More...
 
HlmsDatablockclone (String name) const
 Creates a copy of this datablock with the same settings, but a different name. More...
 
CompareFunction getAlphaTest () const
 
bool getAlphaTestShadowCasterOnly () const
 
float getAlphaTestThreshold () const
 
const ConstBufferPool::BufferPoolgetAssignedPool () const
 
uint32 getAssignedSlot () const
 
const HlmsBlendblockgetBlendblock (bool casterBlock=false) const
 
HlmsgetCreator () const
 
virtual ColourValue getDiffuseColour () const
 Returns the closest match for a diffuse colour, if applicable by the actual implementation. More...
 
virtual TextureGpugetDiffuseTexture () const
 Returns the closest match for a diffuse texture, if applicable by the actual implementation. More...
 
uint8 getDirtyFlags () const
 
virtual ColourValue getEmissiveColour () const
 Returns the closest match for a emissive colour, if applicable by the actual implementation. More...
 
virtual TextureGpugetEmissiveTexture () const
 Returns the closest match for a emissive texture, if applicable by the actual implementation. More...
 
void getFilenameAndResourceGroup (String const **outFilename, String const **outResourceGroup) const
 
uint8 getIndexToDescriptorSampler (uint8 texType)
 Do not call this function if RSC_SEPARATE_SAMPLERS_FROM_TEXTURES is not set. More...
 
uint8 getIndexToDescriptorTexture (uint8 texType)
 This function has O( log N ) complexity, but O(1) if the texture was not set. More...
 
const vector< Renderable * >::type & getLinkedRenderables () const
 
const HlmsMacroblockgetMacroblock (bool casterBlock=false) const
 
IdString getName () const
 
const StringgetNameStr () const
 
const HlmsSamplerblockgetSamplerblock (uint8 texType) const
 
TextureGpugetTexture (uint8 texType) const
 
virtual bool hasCustomShadowMacroblock () const
 
void loadAllTextures ()
 
virtual void notifyTextureChanged (TextureGpu *texture, TextureGpuListener::Reason reason, void *extraData)
 Called when a TextureGpu changed in a way that affects how it is displayed: More...
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete (void *ptr, void *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info More...
 
void * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz)
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
virtual void saveTextures (const String &folderPath, set< String >::type &savedTextures, bool saveOitd, bool saveOriginal, HlmsTextureExportListener *listener)
 
virtual void setAlphaTest (CompareFunction compareFunction, bool shadowCasterOnly=false, bool useAlphaFromTextures=true)
 Sets the alpha test to the given compare function. More...
 
virtual void setAlphaTestThreshold (float threshold)
 Alpha test's threshold. More...
 
void setBlendblock (const HlmsBlendblock &blendblock, bool casterBlock=false)
 Sets a new blendblock that matches the same parameter as the input. More...
 
void setBlendblock (const HlmsBlendblock *blendblock, bool casterBlock=false)
 Sets the blendblock from the given pointer that was already retrieved from the HlmsManager. More...
 
void setMacroblock (const HlmsMacroblock &macroblock, bool casterBlock=false)
 Sets a new macroblock that matches the same parameter as the input. More...
 
void setMacroblock (const HlmsMacroblock *macroblock, bool casterBlock=false)
 Sets the macroblock from the given pointer that was already retrieved from the HlmsManager. More...
 
void setSamplerblock (uint8 texType, const HlmsSamplerblock &params)
 Sets a new sampler block to be associated with the texture (i.e. More...
 
void setTexture (uint8 texType, TextureGpu *texture, const HlmsSamplerblock *refParams=0, uint16 sliceIdx=std::numeric_limits< uint16 >::max())
 Sets a new texture for rendering. More...
 
virtual bool shouldStayLoaded (TextureGpu *texture)
 Return true if this TextureGpu should likely stay loaded or else graphical changes could occur. More...
 

Static Public Member Functions

static const char * getCmpString (CompareFunction compareFunction)
 

Public Attributes

bool mAllowTextureResidencyChange
 When false, we won't try to have Textures become resident. More...
 
uint16 mMacroblockHash [2]
 
float mShadowConstantBias
 
uint32 mTextureHash
 
uint8 mType
 

Detailed Description

This is not a regular header, therefore it has no include guards.

This header contains a base class that defines common functionality across multiple Hlms datablock implementations that need textures. However C++ does not let us statically define the size of mTexIndices, mTextures & mSamplerblocks array; we would have to either force the same maximum to all implementations, or use the heap.

Therefore this header uses macros to customize each base class for each implementations. DO NOT INCLUDE THIS HEADER DIRECTLY.

The way to include this header is by doing:

#define _OgreHlmsTextureBaseClassExport _OgreHlmsUnlitExport
#define OGRE_HLMS_TEXTURE_BASE_CLASS HlmsUnlitBaseTextureDatablock
#define OGRE_HLMS_TEXTURE_BASE_MAX_TEX NUM_UNLIT_TEXTURE_TYPES
#define OGRE_HLMS_CREATOR_CLASS HlmsUnlit
#undef _OgreHlmsTextureBaseClassExport
#undef OGRE_HLMS_TEXTURE_BASE_CLASS
#undef OGRE_HLMS_TEXTURE_BASE_MAX_TEX
#undef OGRE_HLMS_CREATOR_CLASS

Where all the necessary macros are defined prior to including this header, and once we're done, we undef these macros.

When OGRE_HLMS_TEXTURE_BASE_CLASS is not defined, the *.inl version of this file will include a few headers in order to get proper syntax highlighting.

Member Enumeration Documentation

◆ Reason

Enumerator
Unknown 
FromStorageToSysRam 

OnStorage -> OnSystemRam.

FromSysRamToStorage 

OnSystemRam -> OnStorage.

GainedResidency 

OnStorage -> Resident OnSystemRam -> Resident See ReadyForRendering.

LostResidency 

Resident -> OnStorage Resident -> OnSystemRam.

PoolTextureSlotChanged 
ResidentToSysRamSync 

Only called while TextureGpu is still Resident, and strategy is AlwaysKeepSystemRamCopy.

This listener happens when something was done to the TextureGpu that modifies its contents in the GPU, and were thus forced to sync those values back to SystemRam. This listener calls tells that sync is over.

MetadataCacheOutOfDate 

The Metadata cache was out of date and we had to do a ping-pong.

Expect this to be followed by at least LostResidency and GainedResidency calls

This is very important, because if you were expecting certain sequence of calls (e.g. you were expecting a LostResidency soon to arrive), expect that to be changed.

See TextureGpuManager for details about the metadata cache.

ExceptionThrown 

Called when the worker thread caught an exception.

This exception has already been logged, and the texture resumed loading normally with a white 2x2 RGBA8 fallback.

This listener will get called from the main thread.

The texture may still have pending residency transitions (e.g. it may still be loading the 2x2 fallback)

Cast Exception e = reinterpret_cast<Exception>( extraData ); to know more info

FsaaSettingAlteredByApi 

Requested FSAA (MSAA / CSAA / EQAA / etc) is not supported by the API, and thus the setting had to be downgraded.

Note this may happen on device lost, and a new GPU became in use; thus it's possible for a TextureGpu to initially support certain FSAA but later change.

ReadyForRendering 

This Reason is called when TextureGpu::notifyDataIsReady is called.

This normally means worker thread is done loading texture from file and uploading it to GPU; and can now be used for rendering. It does NOT mean that Ogre has finished issueing rendering commands to a RenderTexture and is now ready to be presented to the monitor.

Deleted 

Member Function Documentation

◆ _linkRenderable()

void Ogre::HlmsDatablock::_linkRenderable ( Renderable renderable)
inherited

◆ _unlinkRenderable()

void Ogre::HlmsDatablock::_unlinkRenderable ( Renderable renderable)
inherited

◆ calculateHash()

virtual void Ogre::HlmsDatablock::calculateHash ( )
inlinevirtualinherited

Calculates the hashes needed for sorting by the RenderQueue (i.e. mTextureHash)

◆ clone()

HlmsDatablock* Ogre::HlmsDatablock::clone ( String  name) const
inherited

Creates a copy of this datablock with the same settings, but a different name.

Parameters
nameName of the cloned datablock.

◆ getAlphaTest()

CompareFunction Ogre::HlmsDatablock::getAlphaTest ( ) const
inherited

◆ getAlphaTestShadowCasterOnly()

bool Ogre::HlmsDatablock::getAlphaTestShadowCasterOnly ( ) const
inherited

◆ getAlphaTestThreshold()

float Ogre::HlmsDatablock::getAlphaTestThreshold ( ) const
inlineinherited

◆ getAssignedPool()

const ConstBufferPool::BufferPool* Ogre::ConstBufferPoolUser::getAssignedPool ( ) const
inlineinherited

◆ getAssignedSlot()

uint32 Ogre::ConstBufferPoolUser::getAssignedSlot ( ) const
inlineinherited

◆ getBlendblock()

const HlmsBlendblock* Ogre::HlmsDatablock::getBlendblock ( bool  casterBlock = false) const
inlineinherited

◆ getCmpString()

static const char* Ogre::HlmsDatablock::getCmpString ( CompareFunction  compareFunction)
staticinherited

◆ getCreator()

Hlms* Ogre::HlmsDatablock::getCreator ( ) const
inlineinherited

◆ getDiffuseColour()

virtual ColourValue Ogre::HlmsDatablock::getDiffuseColour ( ) const
virtualinherited

Returns the closest match for a diffuse colour, if applicable by the actual implementation.

Note that Unlit implementation returns 0 as diffuse, since it's considered emissive instead due to being bright even in the absence lights.

◆ getDiffuseTexture()

virtual TextureGpu* Ogre::HlmsDatablock::getDiffuseTexture ( ) const
virtualinherited

Returns the closest match for a diffuse texture, if applicable by the actual implementation.

See HlmsDatablock::getDiffuseColour

◆ getDirtyFlags()

uint8 Ogre::ConstBufferPoolUser::getDirtyFlags ( ) const
inlineinherited

◆ getEmissiveColour()

virtual ColourValue Ogre::HlmsDatablock::getEmissiveColour ( ) const
virtualinherited

Returns the closest match for a emissive colour, if applicable by the actual implementation.

See HlmsDatablock::getDiffuseColour

◆ getEmissiveTexture()

virtual TextureGpu* Ogre::HlmsDatablock::getEmissiveTexture ( ) const
virtualinherited

Returns the closest match for a emissive texture, if applicable by the actual implementation.

See HlmsDatablock::getDiffuseColour

◆ getFilenameAndResourceGroup()

void Ogre::HlmsDatablock::getFilenameAndResourceGroup ( String const **  outFilename,
String const **  outResourceGroup 
) const
inherited
See also
Hlms::getFilenameAndResourceGroup. This operations is NOT fast. Might return null (if the datablock was removed from the Hlms but somehow is still alive) Usage: String const *filename; String const *resourceGroup; datablock->getFilenameAndResourceGroup( &filename, &resourceGroup ); if( filename && resourceGroup && !filename->empty() && !resourceGroup->empty() ) { //Valid filename & resource group. }

◆ getLinkedRenderables()

const vector<Renderable*>::type& Ogre::HlmsDatablock::getLinkedRenderables ( ) const
inlineinherited

◆ getMacroblock()

const HlmsMacroblock* Ogre::HlmsDatablock::getMacroblock ( bool  casterBlock = false) const
inlineinherited

◆ getName()

IdString Ogre::HlmsDatablock::getName ( ) const
inlineinherited

◆ getNameStr()

const String* Ogre::HlmsDatablock::getNameStr ( ) const
inherited
See also
Hlms::getNameStr. This operations is NOT fast. Might return null (if the datablock was removed from the Hlms but somehow is still alive)

◆ hasCustomShadowMacroblock()

virtual bool Ogre::HlmsDatablock::hasCustomShadowMacroblock ( ) const
virtualinherited

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator new() [1/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [2/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [3/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

◆ operator new[]() [1/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

◆ operator new[]() [2/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

◆ setAlphaTest()

virtual void Ogre::HlmsDatablock::setAlphaTest ( CompareFunction  compareFunction,
bool  shadowCasterOnly = false,
bool  useAlphaFromTextures = true 
)
virtualinherited

Sets the alpha test to the given compare function.

CMPF_ALWAYS_PASS means disabled.

See also
mAlphaTestThreshold. Calling this function triggers a HlmsDatablock::flushRenderables
Remarks
It is to the derived implementation to actually implement the alpha test.
Parameters
compareFunctionCompare function to use. Default is CMPF_ALWAYS_PASS, which means disabled. Note: CMPF_ALWAYS_FAIL is not supported. Set a negative threshold to workaround this issue.
shadowCasterOnlyWhen true, only the caster should use alpha testing. Useful if you want alpha blending (i.e. transparency) while rendering normally, but want semi-transparent shadows.
useAlphaFromTexturesWhether you want the diffuse texture's alpha to influence the alpha test Most likely you want this to be true, unless you're customizing the shader and have special use for alpha testing

◆ setAlphaTestThreshold()

virtual void Ogre::HlmsDatablock::setAlphaTestThreshold ( float  threshold)
virtualinherited

Alpha test's threshold.

See also
setAlphaTest
Parameters
thresholdValue typically in the range [0; 1)

◆ setBlendblock() [1/2]

void Ogre::HlmsDatablock::setBlendblock ( const HlmsBlendblock blendblock,
bool  casterBlock = false 
)
inherited

Sets a new blendblock that matches the same parameter as the input.

Decreases the reference count of the previous mBlendblock. Runs an O(N) search to get the right block. Calling this function triggers a HlmsDatablock::flushRenderables

Parameters
blendblock@See HlmsManager::getBlendblock
casterBlockTrue to directly set the blendblock to be used during the shadow mapping's caster pass. Note that when false, it will reset the caster block to the same as the regular one.

◆ setBlendblock() [2/2]

void Ogre::HlmsDatablock::setBlendblock ( const HlmsBlendblock blendblock,
bool  casterBlock = false 
)
inherited

Sets the blendblock from the given pointer that was already retrieved from the HlmsManager.

Unlike the other overload, this operation is O(1). Calling this function triggers a HlmsDatablock::flushRenderables

Parameters
blendblockA valid block. The reference count is increased inside this function.
casterBlockTrue to directly set the blendblock to be used during the shadow mapping's caster pass. Note that when false, it will reset the caster block to the same as the regular one.

◆ setMacroblock() [1/2]

void Ogre::HlmsDatablock::setMacroblock ( const HlmsMacroblock macroblock,
bool  casterBlock = false 
)
inherited

Sets a new macroblock that matches the same parameter as the input.

Decreases the reference count of the previously set one. Runs an O(N) search to get the right block. Calling this function triggers a HlmsDatablock::flushRenderables

Parameters
macroblock@See HlmsManager::getMacroblock
casterBlockTrue to directly set the macroblock to be used during the shadow mapping's caster pass. Note that when false, it will automatically reset the caster's block according to HlmsManager::setShadowMappingUseBackFaces setting.

◆ setMacroblock() [2/2]

void Ogre::HlmsDatablock::setMacroblock ( const HlmsMacroblock macroblock,
bool  casterBlock = false 
)
inherited

Sets the macroblock from the given pointer that was already retrieved from the HlmsManager.

Unlike the other overload, this operation is O(1). Calling this function triggers a HlmsDatablock::flushRenderables

Parameters
macroblockA valid block. The reference count is increased inside this function.
casterBlockTrue to directly set the macroblock to be used during the shadow mapping's caster pass. Note that when false, it will automatically reset the caster's block according to HlmsManager::setShadowMappingUseBackFaces setting.

Member Data Documentation

◆ mAllowTextureResidencyChange

bool Ogre::HlmsDatablock::mAllowTextureResidencyChange
inherited

When false, we won't try to have Textures become resident.

◆ mMacroblockHash

uint16 Ogre::HlmsDatablock::mMacroblockHash[2]
inherited

◆ mShadowConstantBias

float Ogre::HlmsDatablock::mShadowConstantBias
inherited

◆ mTextureHash

uint32 Ogre::HlmsDatablock::mTextureHash
inherited

◆ mType

uint8 Ogre::HlmsDatablock::mType
inherited

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