OGRE 2.1
Object-Oriented Graphics Rendering Engine
Loading...
Searching...
No Matches
Ogre::HlmsLowLevel Class Reference

This is an HLMS implementation that acts as proxy to use the Material system from Ogre 1.9 The older material system is data-driven (thanks to AutoParamDataSource) compared to HLMS where the user needs to write its own implementation in C++ (or modify an exisiting one). More...

#include <OgreHlmsLowLevel.h>

+ Inheritance diagram for Ogre::HlmsLowLevel:

Public Types

typedef std::map< IdString, DatablockEntryHlmsDatablockMap
 
typedef vector< Library >::type LibraryVec
 
enum  LightGatheringMode { LightGatherForward , LightGatherForwardPlus , LightGatherDeferred , LightGatherNone }
 

Public Member Functions

 HlmsLowLevel ()
 
 ~HlmsLowLevel ()
 
virtual void _changeRenderSystem (RenderSystem *newRs)
 
void _clearShaderCache (void)
 
virtual void _collectSamplerblocks (set< const HlmsSamplerblock * >::type &outSamplerblocks, const HlmsDatablock *datablock) const
 
void _compileShaderFromPreprocessedSource (const RenderableCache &mergedCache, const String source[NumShaderTypes])
 
AutoParamDataSource_getAutoParamDataSource (void) const
 
int32 _getProperty (IdString key, int32 defaultVal=0) const
 
virtual void _loadJson (const rapidjson::Value &jsonValue, const HlmsJson::NamedBlocks &blocks, HlmsDatablock *datablock, HlmsJsonListener *listener, const String &additionalTextureExtension) const
 Loads datablock values from a JSON value.
 
void _notifyManager (HlmsManager *manager)
 
void _notifyShadowMappingBackFaceSetting (void)
 Internal use.
 
virtual void _saveJson (const HlmsDatablock *datablock, String &outString, HlmsJsonListener *listener, const String &additionalTextureExtension) const
 
void _setProperty (IdString key, int32 value)
 For debugging stuff. I.e. the Command line uses it for testing manually set properties.
 
virtual void calculateHashFor (Renderable *renderable, uint32 &outHash, uint32 &outCasterHash)
 Called by the renderable when either it changes the material, or its properties change (e.g.
 
void compileShaderCode (ShaderCodeCache &codeCache)
 Compiles input properties and adds it to the shader code cache.
 
HlmsDatablockcreateDatablock (IdString name, const String &refName, const HlmsMacroblock &macroblockRef, const HlmsBlendblock &blendblockRef, const HlmsParamVec &paramVec, bool visibleToManager=true, const String &filename=BLANKSTRING, const String &resourceGroup=BLANKSTRING)
 Creates a unique datablock that can be shared by multiple renderables.
 
void destroyAllDatablocks (void)
 Destroys all datablocks created with @createDatablock.
 
void destroyDatablock (IdString name)
 Destroys a datablocks given its name.
 
void executeCommand (const MovableObject *movableObject, Renderable *renderable, bool casterPass)
 
virtual uint32 fillBuffersFor (const HlmsCache *cache, const QueuedRenderable &queuedRenderable, bool casterPass, uint32 lastCacheHash, uint32 lastTextureHash)
 Fills the constant buffers.
 
virtual uint32 fillBuffersForV1 (const HlmsCache *cache, const QueuedRenderable &queuedRenderable, bool casterPass, uint32 lastCacheHash, CommandBuffer *commandBuffer)
 
virtual uint32 fillBuffersForV2 (const HlmsCache *cache, const QueuedRenderable &queuedRenderable, bool casterPass, uint32 lastCacheHash, CommandBuffer *commandBuffer)
 
virtual void frameEnded (void)
 Called when the frame has fully ended (ALL passes have been executed to all RTTs)
 
uint16 getAreaLightsLimit (void) const
 
uint8 getAreaLightsRoundMultiple (void) const
 
HlmsDatablockgetDatablock (IdString name) const
 Finds an existing datablock based on its name (.
 
const HlmsDatablockMapgetDatablockMap (void) const
 Returns all datablocks owned by this Hlms, including the default one.
 
ArchivegetDataFolder (void)
 
HlmsDatablockgetDefaultDatablock (void) const
 Datablock to use when another datablock failed or none was specified.
 
void getFilenameAndResourceGroup (IdString name, String const **outFilename, String const **outResourceGroup) const
 Returns the filaname & resource group a datablock was created from, and is associated with its hashed name (this was passed as in @createDatablock).
 
bool getHighQuality (void) const
 
HlmsManagergetHlmsManager (void) const
 
HlmsListenergetListener (void) const
 Returns the current listener.
 
const HlmsCachegetMaterial (HlmsCache const *lastReturnedValue, const HlmsCache &passCache, const QueuedRenderable &queuedRenderable, bool casterPass)
 Retrieves an HlmsCache filled with the GPU programs to be used by the given renderable.
 
const StringgetNameStr (IdString name) const
 Returns the string name associated with its hashed name (this was passed as refName in @createDatablock).
 
const LibraryVecgetPiecesLibrary (void) const
 
ArchiveVec getPiecesLibraryAsArchiveVec (void) const
 
RenderSystemgetRenderSystem (void) const
 
const ShaderCodeCacheVecgetShaderCodeCache (void) const
 
const StringgetShaderProfile (void) const
 
void getTemplateChecksum (uint64 outHash[2]) const
 
HlmsTypes getType (void) const
 
IdString getTypeName (void) const
 
const StringgetTypeNameStr (void) const
 
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 *)
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info
 
voidoperator new (size_t sz, void *ptr)
 placement operator new
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info
 
virtual void postCommandBufferExecution (CommandBuffer *commandBuffer)
 This gets called after executing the command buffer.
 
virtual void preCommandBufferExecution (CommandBuffer *commandBuffer)
 This gets called right before executing the command buffer.
 
virtual HlmsCache preparePassHash (const Ogre::CompositorShadowNode *shadowNode, bool casterPass, bool dualParaboloid, SceneManager *sceneManager)
 Called every frame by the Render Queue to cache the properties needed by this pass.
 
virtual void reloadFrom (Archive *newDataFolder, ArchiveVec *libraryFolders=0)
 Destroys all the cached shaders and in the next opportunity will recreate them from the new location.
 
void saveAllTexturesFromDatablocks (const String &folderPath, set< String >::type &savedTextures, bool saveOitd, bool saveOriginal, HlmsTextureExportListener *listener)
 
void setAreaLightForwardSettings (uint16 areaLightsLimit, uint8 areaLightsRoundMultiple)
 Area lights use regular Forward.
 
void setDebugOutputPath (bool enableDebugOutput, bool outputProperties, const String &path=BLANKSTRING)
 Call to output the automatically generated shaders (which are usually made from templates) on the given folder for inspection, analyzing, debugging, etc.
 
void setHighQuality (bool highQuality)
 Sets the quality of the Hlms.
 
void setListener (HlmsListener *listener)
 Sets a listener to extend an existing Hlms implementation's with custom code, without having to rewrite it or modify the source code directly.
 

Static Public Member Functions

static bool findParamInVec (const HlmsParamVec &paramVec, IdString key, String &inOut)
 Finds the parameter with key 'key' in the given 'paramVec'.
 
static int32 getProperty (const HlmsPropertyVec &properties, IdString key, int32 defaultVal=0)
 Utility helper, mostly useful to HlmsListener implementations.
 
static void setProperty (HlmsPropertyVec &properties, IdString key, int32 value)
 Utility helper, mostly useful to HlmsListener implementations.
 

Detailed Description

This is an HLMS implementation that acts as proxy to use the Material system from Ogre 1.9 The older material system is data-driven (thanks to AutoParamDataSource) compared to HLMS where the user needs to write its own implementation in C++ (or modify an exisiting one).

Old material system is still useful for: Quick prototyping of shaders Postprocessing effects. Take in mind that the old system is slow compared to Hlms. So don't use this proxy for hundreds or more entities.

Remarks
Only Materials with programmable shaders are supported. Fixed Function pipeline is not allowed (use the other HLMS types if you need easy to use materials)

Member Typedef Documentation

◆ HlmsDatablockMap

◆ LibraryVec

Member Enumeration Documentation

◆ LightGatheringMode

Enumerator
LightGatherForward 
LightGatherForwardPlus 
LightGatherDeferred 
LightGatherNone 

Constructor & Destructor Documentation

◆ HlmsLowLevel()

Ogre::HlmsLowLevel::HlmsLowLevel ( )

◆ ~HlmsLowLevel()

Ogre::HlmsLowLevel::~HlmsLowLevel ( )

Member Function Documentation

◆ _changeRenderSystem()

virtual void Ogre::Hlms::_changeRenderSystem ( RenderSystem newRs)
virtualinherited

◆ _clearShaderCache()

void Ogre::Hlms::_clearShaderCache ( void  )
inherited

◆ _collectSamplerblocks()

virtual void Ogre::Hlms::_collectSamplerblocks ( set< const HlmsSamplerblock * >::type &  outSamplerblocks,
const HlmsDatablock datablock 
) const
inlinevirtualinherited

Reimplemented in Ogre::HlmsPbs, and Ogre::HlmsUnlit.

◆ _compileShaderFromPreprocessedSource()

void Ogre::Hlms::_compileShaderFromPreprocessedSource ( const RenderableCache &  mergedCache,
const String  source[NumShaderTypes] 
)
inherited

◆ _getAutoParamDataSource()

AutoParamDataSource * Ogre::HlmsLowLevel::_getAutoParamDataSource ( void  ) const
inline

◆ _getProperty()

int32 Ogre::Hlms::_getProperty ( IdString  key,
int32  defaultVal = 0 
) const
inlineinherited

◆ _loadJson()

virtual void Ogre::Hlms::_loadJson ( const rapidjson::Value jsonValue,
const HlmsJson::NamedBlocks blocks,
HlmsDatablock datablock,
HlmsJsonListener listener,
const String additionalTextureExtension 
) const
inlinevirtualinherited

Loads datablock values from a JSON value.

See also
HlmsJson.
Parameters
jsonValueJSON Object containing the definition of this datablock.
blocksAll the loaded Macro-, Blend- & Samplerblocks the JSON has defined and may be referenced by the datablock declaration.
datablockDatablock to fill the values.

Reimplemented in Ogre::HlmsPbs, and Ogre::HlmsUnlit.

◆ _notifyManager()

void Ogre::Hlms::_notifyManager ( HlmsManager manager)
inlineinherited

◆ _notifyShadowMappingBackFaceSetting()

void Ogre::Hlms::_notifyShadowMappingBackFaceSetting ( void  )
inherited

◆ _saveJson()

virtual void Ogre::Hlms::_saveJson ( const HlmsDatablock datablock,
String outString,
HlmsJsonListener listener,
const String additionalTextureExtension 
) const
inlinevirtualinherited

Reimplemented in Ogre::HlmsPbs, and Ogre::HlmsUnlit.

◆ _setProperty()

void Ogre::Hlms::_setProperty ( IdString  key,
int32  value 
)
inlineinherited

For debugging stuff. I.e. the Command line uses it for testing manually set properties.

◆ calculateHashFor()

virtual void Ogre::HlmsLowLevel::calculateHashFor ( Renderable renderable,
uint32 outHash,
uint32 outCasterHash 
)
virtual

Called by the renderable when either it changes the material, or its properties change (e.g.

the mesh' uvs are stripped)

Parameters
renderableThe renderable the material will be used on.
movableObjectThe MovableObject the material will be used on (usually the parent of renderable)
Returns
A hash. This hash references property parameters that are already cached.

Reimplemented from Ogre::Hlms.

◆ compileShaderCode()

void Ogre::Hlms::compileShaderCode ( ShaderCodeCache &  codeCache)
inherited

Compiles input properties and adds it to the shader code cache.

Parameters
codeCache[in/out] All variables must be filled except for ShaderCodeCache::shaders which is the output

◆ createDatablock()

HlmsDatablock * Ogre::Hlms::createDatablock ( IdString  name,
const String refName,
const HlmsMacroblock macroblockRef,
const HlmsBlendblock blendblockRef,
const HlmsParamVec paramVec,
bool  visibleToManager = true,
const String filename = BLANKSTRING,
const String resourceGroup = BLANKSTRING 
)
inherited

Creates a unique datablock that can be shared by multiple renderables.

Remarks
The name of the datablock must be in paramVec["name"] and must be unique Throws if a datablock with the same name paramVec["name"] already exists
Parameters
nameName of the Datablock, must be unique within all Hlms types, not just this one. 99% you want this to be IdString( refName ); however this is not enforced.
refNameName of the Datablock. The engine doesn't use this value at all. It is only useful for UI editors which want to enumerate all existing datablocks and display its name to the user.
macroblockRef@See HlmsManager::getMacroblock
blendblockRef@See HlmsManager::getBlendblock
paramVecKey - String Value list of paramters. MUST BE SORTED.
visibleToManagerWhen false, HlmsManager::getDatablock won't find this datablock. True by default
filenameFilename in which it was defined, so that this information can be retrieved later by the user if needed. This is only for informational purposes.
resourceGroupResourceGroup. See filename param.
Returns
Pointer to created Datablock

◆ destroyAllDatablocks()

void Ogre::Hlms::destroyAllDatablocks ( void  )
inherited

Destroys all datablocks created with @createDatablock.

Caller is responsible for ensuring those pointers aren't still in use (i.e. dangling pointers) The default datablock will be recreated.

◆ destroyDatablock()

void Ogre::Hlms::destroyDatablock ( IdString  name)
inherited

Destroys a datablocks given its name.

Caller is responsible for ensuring those pointers aren't still in use (i.e. dangling pointers)

Remarks
Throws if no datablock with the given name exists.

◆ executeCommand()

void Ogre::HlmsLowLevel::executeCommand ( const MovableObject movableObject,
Renderable renderable,
bool  casterPass 
)

◆ fillBuffersFor()

virtual uint32 Ogre::HlmsLowLevel::fillBuffersFor ( const HlmsCache cache,
const QueuedRenderable queuedRenderable,
bool  casterPass,
uint32  lastCacheHash,
uint32  lastTextureHash 
)
virtual

Fills the constant buffers.

Gets executed right before drawing the mesh.

Parameters
cacheCurrent cache of Shaders to be used.
queuedRenderableThe Renderable-MovableObject pair about to be rendered.
casterPassWhether this is a shadow mapping caster pass.
lastCacheHashThe hash of the cache of shaders that was the used by the previous renderable.
lastTextureHashLast Texture Hash, used to let the Hlms know whether the textures should be changed again
Returns
New Texture hash (may be equal or different to lastTextureHash).

Implements Ogre::Hlms.

◆ fillBuffersForV1()

virtual uint32 Ogre::HlmsLowLevel::fillBuffersForV1 ( const HlmsCache cache,
const QueuedRenderable queuedRenderable,
bool  casterPass,
uint32  lastCacheHash,
CommandBuffer commandBuffer 
)
virtual

Implements Ogre::Hlms.

◆ fillBuffersForV2()

virtual uint32 Ogre::HlmsLowLevel::fillBuffersForV2 ( const HlmsCache cache,
const QueuedRenderable queuedRenderable,
bool  casterPass,
uint32  lastCacheHash,
CommandBuffer commandBuffer 
)
virtual

Implements Ogre::Hlms.

◆ findParamInVec()

static bool Ogre::Hlms::findParamInVec ( const HlmsParamVec paramVec,
IdString  key,
String inOut 
)
staticinherited

Finds the parameter with key 'key' in the given 'paramVec'.

If found, outputs the value to 'inOut', otherwise leaves 'inOut' as is.

Returns
True if the key was found (inOut was modified), false otherwise
Remarks
Assumes paramVec is sorted by key.

◆ frameEnded()

virtual void Ogre::Hlms::frameEnded ( void  )
inlinevirtualinherited

Called when the frame has fully ended (ALL passes have been executed to all RTTs)

Reimplemented in Ogre::HlmsBufferManager, Ogre::HlmsPbs, and Ogre::HlmsUnlit.

◆ getAreaLightsLimit()

uint16 Ogre::Hlms::getAreaLightsLimit ( void  ) const
inlineinherited

◆ getAreaLightsRoundMultiple()

uint8 Ogre::Hlms::getAreaLightsRoundMultiple ( void  ) const
inlineinherited

◆ getDatablock()

HlmsDatablock * Ogre::Hlms::getDatablock ( IdString  name) const
inherited

Finds an existing datablock based on its name (.

See also
createDatablock)
Returns
The datablock associated with that name. Null pointer if not found. Doesn't throw.

◆ getDatablockMap()

const HlmsDatablockMap & Ogre::Hlms::getDatablockMap ( void  ) const
inlineinherited

Returns all datablocks owned by this Hlms, including the default one.

◆ getDataFolder()

Archive * Ogre::Hlms::getDataFolder ( void  )
inlineinherited

◆ getDefaultDatablock()

HlmsDatablock * Ogre::Hlms::getDefaultDatablock ( void  ) const
inherited

Datablock to use when another datablock failed or none was specified.

◆ getFilenameAndResourceGroup()

void Ogre::Hlms::getFilenameAndResourceGroup ( IdString  name,
String const **  outFilename,
String const **  outResourceGroup 
) const
inherited

Returns the filaname & resource group a datablock was created from, and is associated with its hashed name (this was passed as in @createDatablock).

Returns null ptr if not found. Note that it may also be a valid pointer but contain an empty string. The reason this String doesn't live in HlmsDatablock is to prevent cache trashing (datablocks are hot iterated every frame, and the filename & resource groups are rarely ever used) Usage: String const *filename; String const *resourceGroup; datablock->getFilenameAndResourceGroup( &filename, &resourceGroup ); if( filename && resourceGroup && !filename->empty() && !resourceGroup->empty() ) { //Valid filename & resource group. }

◆ getHighQuality()

bool Ogre::Hlms::getHighQuality ( void  ) const
inlineinherited

◆ getHlmsManager()

HlmsManager * Ogre::Hlms::getHlmsManager ( void  ) const
inlineinherited

◆ getListener()

HlmsListener * Ogre::Hlms::getListener ( void  ) const
inherited

Returns the current listener.

See also
setListener();
Remarks
If the default listener is being used (that does nothing) then null is returned.

◆ getMaterial()

const HlmsCache * Ogre::Hlms::getMaterial ( HlmsCache const lastReturnedValue,
const HlmsCache passCache,
const QueuedRenderable queuedRenderable,
bool  casterPass 
)
inherited

Retrieves an HlmsCache filled with the GPU programs to be used by the given renderable.

If the shaders have already been created (i.e. whether for this renderable, or another one) it gets them from a cache. Otherwise we create it. It assumes that renderable->setHlms( this, parameters ) has already called.

Parameters
lastReturnedValueThe last value returned by getMaterial.
passCacheThe cache returned by @preparePassHash.
renderableThe renderable the caller wants us to give the shaders.
movableObjectThe MovableObject owner of the renderable (we need it to know if renderable should cast shadows)
casterPassTrue if this pass is the shadow mapping caster pass, false otherwise
Returns
Structure containing all necessary shaders

◆ getNameStr()

const String * Ogre::Hlms::getNameStr ( IdString  name) const
inherited

Returns the string name associated with its hashed name (this was passed as refName in @createDatablock).

Returns null ptr if not found. The reason this String doesn't live in HlmsDatablock is to prevent cache trashing (datablocks are hot iterated every frame, and the full name is rarely ever used)

◆ getPiecesLibrary()

const LibraryVec & Ogre::Hlms::getPiecesLibrary ( void  ) const
inlineinherited

◆ getPiecesLibraryAsArchiveVec()

ArchiveVec Ogre::Hlms::getPiecesLibraryAsArchiveVec ( void  ) const
inherited

◆ getProperty()

static int32 Ogre::Hlms::getProperty ( const HlmsPropertyVec properties,
IdString  key,
int32  defaultVal = 0 
)
staticinherited

Utility helper, mostly useful to HlmsListener implementations.

◆ getRenderSystem()

RenderSystem * Ogre::Hlms::getRenderSystem ( void  ) const
inlineinherited

◆ getShaderCodeCache()

const ShaderCodeCacheVec & Ogre::Hlms::getShaderCodeCache ( void  ) const
inlineinherited

◆ getShaderProfile()

const String & Ogre::Hlms::getShaderProfile ( void  ) const
inlineinherited

◆ getTemplateChecksum()

void Ogre::Hlms::getTemplateChecksum ( uint64  outHash[2]) const
inherited

◆ getType()

HlmsTypes Ogre::Hlms::getType ( void  ) const
inlineinherited

◆ getTypeName()

IdString Ogre::Hlms::getTypeName ( void  ) const
inlineinherited

◆ getTypeNameStr()

const String & Ogre::Hlms::getTypeNameStr ( void  ) const
inlineinherited

◆ 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

◆ postCommandBufferExecution()

virtual void Ogre::Hlms::postCommandBufferExecution ( CommandBuffer commandBuffer)
inlinevirtualinherited

This gets called after executing the command buffer.

Reimplemented in Ogre::HlmsBufferManager, and Ogre::HlmsPbs.

◆ preCommandBufferExecution()

virtual void Ogre::Hlms::preCommandBufferExecution ( CommandBuffer commandBuffer)
inlinevirtualinherited

This gets called right before executing the command buffer.

Reimplemented in Ogre::HlmsBufferManager.

◆ preparePassHash()

virtual HlmsCache Ogre::HlmsLowLevel::preparePassHash ( const Ogre::CompositorShadowNode shadowNode,
bool  casterPass,
bool  dualParaboloid,
SceneManager sceneManager 
)
virtual

Called every frame by the Render Queue to cache the properties needed by this pass.

i.e. Number of PSSM splits, number of shadow casting lights, etc

Parameters
shadowNodeThe shadow node currently in effect. Can be null.
Returns
A hash and cached property parameters. Unlike @calculateHashFor, the cache must be kept by the caller and not by us (because it may change every frame and is one for the whole pass, but Mesh' properties usually stay consistent through its lifetime but may differ per mesh)

Reimplemented from Ogre::Hlms.

◆ reloadFrom()

virtual void Ogre::Hlms::reloadFrom ( Archive newDataFolder,
ArchiveVec libraryFolders = 0 
)
virtualinherited

Destroys all the cached shaders and in the next opportunity will recreate them from the new location.

This is very useful for fast iteration and real-time editing of Hlms shader templates.

Remarks
Calling with null pointer is possible and will only invalidate existing shaders but you should provide a valid pointer before we start generating the first shader (or else crash).
Existing datablock materials won't be reloaded from files, so their properties won't change (i.e. changed from blue to red), but the shaders will.
Parameters
libraryFoldersWhen null pointer, the library folders paths won't be changed at all (but still will be reloaded). When non-null pointer, the library folders will be overwriten. Pass an empty container if you want to stop using libraries.

Reimplemented in Ogre::HlmsCompute.

◆ saveAllTexturesFromDatablocks()

void Ogre::Hlms::saveAllTexturesFromDatablocks ( const String folderPath,
set< String >::type &  savedTextures,
bool  saveOitd,
bool  saveOriginal,
HlmsTextureExportListener listener 
)
inherited

◆ setAreaLightForwardSettings()

void Ogre::Hlms::setAreaLightForwardSettings ( uint16  areaLightsLimit,
uint8  areaLightsRoundMultiple 
)
inherited

Area lights use regular Forward.

Parameters
areaLightsLimitMaximum number of area lights that will be considered by the shader. Default value is 1. Use 0 to disable area lights.
areaLightsRoundMultipleTo prevent frequent shader recompiles, you can round the number of area lights to the next multiple.

For example when areaLightsRoundMultiple = 1, if there are two area lights in the frustum, shader 'A' will be used. If the camera moves and now only one are light is in the frustum, shader 'B' will be used.

This maximizes GPU performance, but if the number of area lights is constantly jumping, you may see a lot of recompiles until all variations are cached, which can be very slow.

By setting for example, areaLightsRoundMultiple = 2, we will always generate shader variations that use 2 area lights, even if there's only 1 area light in the camera (if there's none, we use a different variation). The unused slot will just output black. If there's 3 area lights, the shader variation will be compiled to use 4. This sacrifices some pixel shader GPU performance, but prevents permutation explosion.

By setting areaLightsLimit = areaLightsRoundMultiple, you will minimize the number of permutations and stabilize frame rates; but average framerate may be lower if there are less area lights.

Default value is 1. This value cannot be 0. This value must be <= areaLightsLimit, unless areaLightsLimit is 0.

◆ setDebugOutputPath()

void Ogre::Hlms::setDebugOutputPath ( bool  enableDebugOutput,
bool  outputProperties,
const String path = BLANKSTRING 
)
inherited

Call to output the automatically generated shaders (which are usually made from templates) on the given folder for inspection, analyzing, debugging, etc.

Remarks
The shader will be dumped when it is generated, not when this function gets called. You should call this function at start up
Parameters
enableDebugOutputWhether to enable or disable dumping the shaders into a folder
outputPropertiesWhether to dump properties and pieces at the beginning of the shader file. This is very useful for determining what caused Ogre to compile a new variation. Note that this setting may not always produce valid shader code in the dumped files (but it we'll still produce valid shader code while at runtime) If you want to compile the dumped file and it is invalid, just strip this info.
pathPath location on where to dump it. Should end with slash for proper concatenation (i.e. C:/path/ instead of C:/path; or /home/user/ instead of /home/user)

◆ setHighQuality()

void Ogre::Hlms::setHighQuality ( bool  highQuality)
inherited

Sets the quality of the Hlms.

This function is most relevant for mobile and almost or completely ignored by Desktop. The default value is false.

On mobile, high quality will use "highp" quality precision qualifier for all its variables and functions. When not in HQ, mobile users may see aliasing artifacts, gradients; but the performance impact can be quite high. Some GPU drivers might even refuse to execute the shader as they cannot handle it.
Unless you absolutely require high quality rendering on Mobile devices and/or to get it to look as closely as possible as it looks in a Desktop device, the recommended option is to have this off.

◆ setListener()

void Ogre::Hlms::setListener ( HlmsListener listener)
inherited

Sets a listener to extend an existing Hlms implementation's with custom code, without having to rewrite it or modify the source code directly.

Remarks
Other alternatives for extending an existing implementation is to derive from the class and override particular virtual functions. For performance reasons, listeners are never called on a per-object basis. Consult the section "Customizing an existing implementation" from the manual in the Docs/2.0 folder.
Parameters
listenerListener pointer. Use null to disable.

◆ setProperty()

static void Ogre::Hlms::setProperty ( HlmsPropertyVec properties,
IdString  key,
int32  value 
)
staticinherited

Utility helper, mostly useful to HlmsListener implementations.


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