OGRE  2.2.4
Object-Oriented Graphics Rendering Engine
Ogre::HlmsPbs Class Reference

Physically based shading implementation specfically designed for OpenGL 3+, D3D11 and other RenderSystems which support uniform buffers. More...

#include <OgreHlmsPbs.h>

+ Inheritance diagram for Ogre::HlmsPbs:

Public Types

enum  AmbientLightMode {
  AmbientAuto, AmbientFixed, AmbientHemisphere, AmbientSh,
  AmbientShMonochrome, AmbientNone
}
 
enum  DirtyFlags { DirtyNone = 0u, DirtyConstBuffer = 1u << 0u, DirtyTextures = 1u << 1u, DirtySamplers = 1u << 2u }
 
typedef std::map< IdString, DatablockEntryHlmsDatablockMap
 
typedef vector< Library >::type LibraryVec
 
enum  LightGatheringMode { LightGatherForward, LightGatherForwardPlus, LightGatherDeferred, LightGatherNone }
 
enum  OptimizationStrategy { LowerCpuOverhead, LowerGpuOverhead }
 
enum  ShadowFilter {
  PCF_2x2, PCF_3x3, PCF_4x4, PCF_5x5,
  PCF_6x6, ExponentialShadowMaps, NumShadowFilter
}
 

Public Member Functions

 HlmsPbs (Archive *dataFolder, ArchiveVec *libraryFolders)
 
virtual ~HlmsPbs ()
 
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])
 
int32 _getProperty (IdString key, int32 defaultVal=0) const
 
virtual void _loadJson (const rapidjson::Value &jsonValue, const HlmsJson::NamedBlocks &blocks, HlmsDatablock *datablock, const String &resourceGroup, HlmsJsonListener *listener, const String &additionalTextureExtension) const
 Loads datablock values from a JSON value. More...
 
void _notifyIblSpecMipmap (uint8 numMipmaps)
 
void _notifyManager (HlmsManager *manager)
 
void _notifyShadowMappingBackFaceSetting (void)
 Internal use. More...
 
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. More...
 
void compileShaderCode (ShaderCodeCache &codeCache)
 Compiles input properties and adds it to the shader code cache. More...
 
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. More...
 
void destroyAllDatablocks (void)
 Destroys all datablocks created with . More...
 
void destroyDatablock (IdString name)
 Destroys a datablocks given its name. More...
 
virtual uint32 fillBuffersFor (const HlmsCache *cache, const QueuedRenderable &queuedRenderable, bool casterPass, uint32 lastCacheHash, uint32 lastTextureHash)
 Fills the constant buffers. More...
 
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) More...
 
AmbientLightMode getAmbientLightMode (void) const
 
TextureGpugetAreaLightMasks (void) const
 
uint16 getAreaLightsApproxLimit (void) const
 
uint16 getAreaLightsLtcLimit (void) const
 
HlmsDatablockgetDatablock (IdString name) const
 Finds an existing datablock based on its name (. More...
 
const HlmsDatablockMapgetDatablockMap (void) const
 Returns all datablocks owned by this Hlms, including the default one. More...
 
ArchivegetDataFolder (void)
 
bool getDebugPssmSplits (void) const
 
HlmsDatablockgetDefaultDatablock (void) const
 Datablock to use when another datablock failed or none was specified. More...
 
uint16 getEsmK (void) const
 
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 ). More...
 
bool getFineLightMaskGranularity (void) const
 
bool getHighQuality (void) const
 
HlmsManagergetHlmsManager (void) const
 
IrradianceFieldgetIrradianceField (void)
 
IrradianceVolumegetIrradianceVolume (void) const
 
TextureGpugetLightProfilesTexture (void) const
 
HlmsListenergetListener (void) const
 Returns the current listener. More...
 
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. More...
 
uint16 getMaxNonCasterDirectionalLights (void) const
 
const StringgetNameStr (IdString name) const
 Returns the string name associated with its hashed name (this was passed as refName in ). More...
 
OptimizationStrategy getOptimizationStrategy () const
 
ParallaxCorrectedCubemapBasegetParallaxCorrectedCubemap (void) const
 
bool getPerceptualRoughness (void) const
 
const LibraryVecgetPiecesLibrary (void) const
 
ArchiveVec getPiecesLibraryAsArchiveVec (void) const
 
size_t getPoolIndex (ConstBufferPoolUser *user) const
 Gets an ID corresponding to the pool this user was assigned to, unique per hash. More...
 
RenderSystemgetRenderSystem (void) const
 
const ShaderCodeCacheVec & getShaderCodeCache (void) const
 
const StringgetShaderProfile (void) const
 
ShadowFilter getShadowFilter (void) const
 
void getTemplateChecksum (uint64 outHash[2]) const
 
HlmsTypes getType (void) const
 
IdString getTypeName (void) const
 
const StringgetTypeNameStr (void) const
 
bool getUseLightBuffers ()
 
bool getVctFullConeCount (void) const
 
VctLightinggetVctLighting (void)
 
void loadLtcMatrix (void)
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, void *)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
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 * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
void * operator new[] (size_t sz)
 
virtual void postCommandBufferExecution (CommandBuffer *commandBuffer)
 This gets called after executing the command buffer. More...
 
virtual void preCommandBufferExecution (CommandBuffer *commandBuffer)
 This gets called right before executing the command buffer. More...
 
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. More...
 
void releaseSlot (ConstBufferPoolUser *user)
 Releases a slot requested with requestSlot. More...
 
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. More...
 
void requestSlot (uint32 hash, ConstBufferPoolUser *user, bool wantsExtraBuffer)
 Requests a slot and fills 'user'. Automatically schedules for update. More...
 
void resetIblSpecMipmap (uint8 numMipmaps)
 By default we see the reflection textures' mipmaps and store the largest one we found. More...
 
void saveAllTexturesFromDatablocks (const String &folderPath, set< String >::type &savedTextures, bool saveOitd, bool saveOriginal, HlmsTextureExportListener *listener)
 
void scheduleForUpdate (ConstBufferPoolUser *dirtyUser, uint8 dirtyFlags=DirtyConstBuffer)
 
void setAmbientLightMode (AmbientLightMode mode)
 
void setAreaLightForwardSettings (uint16 areaLightsApproxLimit, uint16 areaLightsLtcLimit)
 Area lights use regular Forward. More...
 
void setAreaLightMasks (TextureGpu *areaLightMask)
 
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. More...
 
void setDebugPssmSplits (bool bDebug)
 
void setEsmK (uint16 K)
 Sets the 'K' parameter of ESM filter. More...
 
void setFineLightMaskGranularity (bool useFineGranularity)
 Toggles whether light masks will be obeyed per object by doing: if( movableObject->getLightMask() & light->getLightMask() ) doLighting( movableObject light ); Note this toggle only affects forward lights (i.e. More...
 
void setHighQuality (bool highQuality)
 Sets the quality of the Hlms. More...
 
void setIrradianceField (IrradianceField *irradianceField)
 
void setIrradianceVolume (IrradianceVolume *irradianceVolume)
 
void setLightProfilesTexture (TextureGpu *lightProfilesTex)
 
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. More...
 
void setMaxNonCasterDirectionalLights (uint16 maxLights)
 Non-caster directional lights are hardcoded into shaders. More...
 
virtual void setOptimizationStrategy (OptimizationStrategy optimizationStrategy)
 Sets the optimization strategy. More...
 
void setParallaxCorrectedCubemap (ParallaxCorrectedCubemapBase *pcc, float pccVctMinDistance=1.0f, float pccVctMaxDistance=2.0f)
 Sets PCC. More...
 
void setPerceptualRoughness (bool bPerceptualRoughness)
 Toggle whether the roughness value (set via material parameters and via roughness textures) is perceptual or raw. More...
 
void setShadowSettings (ShadowFilter filter)
 
void setTextureBufferDefaultSize (size_t defaultSize)
 Changes the default suggested size for the texture buffer. More...
 
void setUseLightBuffers (bool b)
 
void setVctFullConeCount (bool vctFullConeCount)
 When false, we will use 4 cones for diffuse VCT. More...
 
void setVctLighting (VctLighting *vctLighting)
 

Static Public Member Functions

static bool findParamInVec (const HlmsParamVec &paramVec, IdString key, String &inOut)
 Finds the parameter with key 'key' in the given 'paramVec'. More...
 
static void getDefaultPaths (String &outDataFolderPath, StringVector &outLibraryFoldersPaths)
 Fill the provided string and string vector with all the sub-folder needed to instantiate an HlmsPbs object with the default distribution of the HlmsResources. More...
 
static int32 getProperty (const HlmsPropertyVec &properties, IdString key, int32 defaultVal=0)
 Utility helper, mostly useful to HlmsListener implementations. More...
 
static void setProperty (HlmsPropertyVec &properties, IdString key, int32 value)
 Utility helper, mostly useful to HlmsListener implementations. More...
 

Detailed Description

Physically based shading implementation specfically designed for OpenGL 3+, D3D11 and other RenderSystems which support uniform buffers.

Member Typedef Documentation

◆ HlmsDatablockMap

◆ LibraryVec

typedef vector<Library>::type Ogre::Hlms::LibraryVec
inherited

Member Enumeration Documentation

◆ AmbientLightMode

Enumerator
AmbientAuto 

Use fixed-colour ambient lighting when upper hemisphere = lower hemisphere, use hemisphere lighting when they don't match.

Disables ambient lighting if the colours are black.

AmbientFixed 

Force fixed-colour ambient light. Only uses the upper hemisphere paramter.

AmbientHemisphere 

Force hemisphere ambient light.

Useful if you plan on adjusting the colours dynamically very often and this might cause swapping shaders.

AmbientSh 

Uses spherical harmonics.

AmbientShMonochrome 

Uses spherical harmonics (monochrome / single channel)

AmbientNone 

Disable ambient lighting.

◆ DirtyFlags

Enumerator
DirtyNone 
DirtyConstBuffer 
DirtyTextures 
DirtySamplers 

◆ LightGatheringMode

Enumerator
LightGatherForward 
LightGatherForwardPlus 
LightGatherDeferred 
LightGatherNone 

◆ OptimizationStrategy

Enumerator
LowerCpuOverhead 

Optimize for low CPU overhead.

Use this on slow CPUs (i.e. older AMD CPU models) or if CPU is the bottleneck. This strategy is optimized for having a lot of different materials. Default on Desktop.

LowerGpuOverhead 

Optimize for low GPU overhead.

Use this if GPU is the bottleneck. This strategy performs best when you have few materials. Do not enable this mode blindly unless you've profiled and it gives you important benefits. Default on mobile.

◆ ShadowFilter

Enumerator
PCF_2x2 

Standard quality. Very fast.

PCF_3x3 

Good quality. Still quite fast on most modern hardware.

PCF_4x4 

High quality.

Very slow in old hardware (i.e. DX10 level hw and below) Use RSC_TEXTURE_GATHER to check whether it will be slow or not.

PCF_5x5 

Better and slower than 4x4, same considerations.

PCF_6x6 

Better and slower than 5x5, same considerations.

ExponentialShadowMaps 

High quality.

Produces soft shadows. It's much more expensive but given its blurry results, you can reduce resolution and/or use less PSSM splits which gives you very competing performance with great results. ESM stands for Exponential Shadow Maps.

NumShadowFilter 

Constructor & Destructor Documentation

◆ HlmsPbs()

Ogre::HlmsPbs::HlmsPbs ( Archive dataFolder,
ArchiveVec libraryFolders 
)

◆ ~HlmsPbs()

virtual Ogre::HlmsPbs::~HlmsPbs ( )
virtual

Member Function Documentation

◆ _changeRenderSystem()

virtual void Ogre::HlmsPbs::_changeRenderSystem ( RenderSystem newRs)
virtual

Reimplemented from Ogre::ConstBufferPool.

◆ _clearShaderCache()

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

◆ _collectSamplerblocks()

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

Reimplemented from Ogre::Hlms.

◆ _compileShaderFromPreprocessedSource()

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

◆ _getProperty()

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

◆ _loadJson()

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

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 from Ogre::Hlms.

◆ _notifyIblSpecMipmap()

void Ogre::HlmsPbs::_notifyIblSpecMipmap ( uint8  numMipmaps)

◆ _notifyManager()

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

◆ _notifyShadowMappingBackFaceSetting()

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

◆ _saveJson()

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

Reimplemented from Ogre::Hlms.

◆ _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.

◆ 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.
macroblockRefHlmsManager::getMacroblock
blendblockRefHlmsManager::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 .

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.

◆ fillBuffersFor()

virtual uint32 Ogre::HlmsPbs::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::HlmsPbs::fillBuffersForV1 ( const HlmsCache cache,
const QueuedRenderable queuedRenderable,
bool  casterPass,
uint32  lastCacheHash,
CommandBuffer commandBuffer 
)
virtual

Implements Ogre::Hlms.

◆ fillBuffersForV2()

virtual uint32 Ogre::HlmsPbs::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::HlmsPbs::frameEnded ( void  )
virtual

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

Reimplemented from Ogre::HlmsBufferManager.

◆ getAmbientLightMode()

AmbientLightMode Ogre::HlmsPbs::getAmbientLightMode ( void  ) const
inline

◆ getAreaLightMasks()

TextureGpu* Ogre::HlmsPbs::getAreaLightMasks ( void  ) const
inline

◆ getAreaLightsApproxLimit()

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

◆ getAreaLightsLtcLimit()

uint16 Ogre::Hlms::getAreaLightsLtcLimit ( 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

◆ getDebugPssmSplits()

bool Ogre::HlmsPbs::getDebugPssmSplits ( void  ) const
inline

◆ getDefaultDatablock()

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

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

◆ getDefaultPaths()

static void Ogre::HlmsPbs::getDefaultPaths ( String outDataFolderPath,
StringVector outLibraryFoldersPaths 
)
static

Fill the provided string and string vector with all the sub-folder needed to instantiate an HlmsPbs object with the default distribution of the HlmsResources.

These paths are dependent of the current RenderSystem.

This method can only be called after a valid RenderSysttem has been chosen.

All output parameter's content will be replaced with the new set of paths.

Parameters
outDataFolderPathPath (as a String) used for creating the "dataFolder" Archive the constructor will need
outLibraryFoldersPathsVector of String used for creating the ArchiveVector "libraryFolders" the constructor will need

◆ getEsmK()

uint16 Ogre::HlmsPbs::getEsmK ( void  ) const
inline

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

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. }

◆ getFineLightMaskGranularity()

bool Ogre::HlmsPbs::getFineLightMaskGranularity ( void  ) const
inline

◆ getHighQuality()

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

◆ getHlmsManager()

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

◆ getIrradianceField()

IrradianceField* Ogre::HlmsPbs::getIrradianceField ( void  )
inline

◆ getIrradianceVolume()

IrradianceVolume* Ogre::HlmsPbs::getIrradianceVolume ( void  ) const
inline

◆ getLightProfilesTexture()

TextureGpu* Ogre::HlmsPbs::getLightProfilesTexture ( void  ) const
inline

◆ 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 .
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

◆ getMaxNonCasterDirectionalLights()

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

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

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)

◆ getOptimizationStrategy()

OptimizationStrategy Ogre::ConstBufferPool::getOptimizationStrategy ( ) const
inherited

◆ getParallaxCorrectedCubemap()

ParallaxCorrectedCubemapBase* Ogre::HlmsPbs::getParallaxCorrectedCubemap ( void  ) const
inline

◆ getPerceptualRoughness()

bool Ogre::HlmsPbs::getPerceptualRoughness ( void  ) const

◆ getPiecesLibrary()

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

References Ogre::BLANKSTRING.

◆ getPiecesLibraryAsArchiveVec()

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

◆ getPoolIndex()

size_t Ogre::ConstBufferPool::getPoolIndex ( ConstBufferPoolUser user) const
inherited

Gets an ID corresponding to the pool this user was assigned to, unique per hash.

◆ 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

◆ getShadowFilter()

ShadowFilter Ogre::HlmsPbs::getShadowFilter ( void  ) const
inline

◆ 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

◆ getUseLightBuffers()

bool Ogre::HlmsPbs::getUseLightBuffers ( )
inline

◆ getVctFullConeCount()

bool Ogre::HlmsPbs::getVctFullConeCount ( void  ) const
inline

◆ getVctLighting()

VctLighting* Ogre::HlmsPbs::getVctLighting ( void  )
inline

◆ loadLtcMatrix()

void Ogre::HlmsPbs::loadLtcMatrix ( void  )

◆ 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,
void *   
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
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,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [2/3]

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

◆ 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,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

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

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

◆ postCommandBufferExecution()

virtual void Ogre::HlmsPbs::postCommandBufferExecution ( CommandBuffer commandBuffer)
virtual

This gets called after executing the command buffer.

Reimplemented from Ogre::HlmsBufferManager.

◆ preCommandBufferExecution()

virtual void Ogre::HlmsBufferManager::preCommandBufferExecution ( CommandBuffer commandBuffer)
virtualinherited

This gets called right before executing the command buffer.

Reimplemented from Ogre::Hlms.

◆ preparePassHash()

virtual HlmsCache Ogre::HlmsPbs::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 , 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::HlmsBufferManager.

◆ releaseSlot()

void Ogre::ConstBufferPool::releaseSlot ( ConstBufferPoolUser user)
inherited

Releases a slot requested with requestSlot.

◆ 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.

◆ requestSlot()

void Ogre::ConstBufferPool::requestSlot ( uint32  hash,
ConstBufferPoolUser user,
bool  wantsExtraBuffer 
)
inherited

Requests a slot and fills 'user'. Automatically schedules for update.

◆ resetIblSpecMipmap()

void Ogre::HlmsPbs::resetIblSpecMipmap ( uint8  numMipmaps)

By default we see the reflection textures' mipmaps and store the largest one we found.

By calling resetIblSpecMipmap; you can reset this process thus if a reflection texture with a large number of mipmaps was removed, these textures can be reevaluated

Parameters
numMipmapsWhen 0; we automatically check for reflection texture. When non-zero, we force the number of mipmaps to the specified value

◆ saveAllTexturesFromDatablocks()

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

◆ scheduleForUpdate()

void Ogre::ConstBufferPool::scheduleForUpdate ( ConstBufferPoolUser dirtyUser,
uint8  dirtyFlags = DirtyConstBuffer 
)
inherited

◆ setAmbientLightMode()

void Ogre::HlmsPbs::setAmbientLightMode ( AmbientLightMode  mode)

◆ setAreaLightForwardSettings()

void Ogre::Hlms::setAreaLightForwardSettings ( uint16  areaLightsApproxLimit,
uint16  areaLightsLtcLimit 
)
inherited

Area lights use regular Forward.

Parameters
areaLightsApproxLimitMaximum number of area approx lights that will be considered by the shader. Default value is 1. Use 0 to disable area lights.

Note: There is little to no performance impact for setting this value higher than you need. e.g. If you set areaLightsApproxLimit = 4, but you only have 2 area lights on scene, you'll pay the price of 2 area lights (but the RAM price of 4).

Beware of setting this value too high (e.g. 65535) as the amount of memory space is limited (we cannot exceed 64kb, including unrelated data to lighting, but required to the pass)

Parameters
areaLightsLtcLimitSame as areaLightsApproxLimit, but for LTC lights

◆ setAreaLightMasks()

void Ogre::HlmsPbs::setAreaLightMasks ( TextureGpu areaLightMask)

◆ 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)

◆ setDebugPssmSplits()

void Ogre::HlmsPbs::setDebugPssmSplits ( bool  bDebug)

◆ setEsmK()

void Ogre::HlmsPbs::setEsmK ( uint16  K)

Sets the 'K' parameter of ESM filter.

Defaults to 600. Small values will give weak shadows, and light bleeding (specially if the caster is close to the receiver; particularly noticeable at contact points). It also gives the chance of over darkening to appear (the shadow of a small caster in front of a large caster looks darker; thus the large caster appers like if it were made of glass instead of being solid).

Large values give strong, dark shadows; but the higher the value, the more you push floating point limits. This value is related to K in MiscUtils::setGaussianLogFilterParams. You don't have to set them to the same value; but you'll notice that if you change this value here, you'll likely have to change the log filter's too.

Parameters
KIn range (0; infinite).

◆ setFineLightMaskGranularity()

void Ogre::HlmsPbs::setFineLightMaskGranularity ( bool  useFineGranularity)
inline

Toggles whether light masks will be obeyed per object by doing: if( movableObject->getLightMask() & light->getLightMask() ) doLighting( movableObject light ); Note this toggle only affects forward lights (i.e.

Directional lights + shadow casting lights). You may want to see ForwardPlusBase::setFineLightMaskGranularity for control over Forward+ lights.

◆ 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.

◆ setIrradianceField()

void Ogre::HlmsPbs::setIrradianceField ( IrradianceField irradianceField)
inline

◆ setIrradianceVolume()

void Ogre::HlmsPbs::setIrradianceVolume ( IrradianceVolume irradianceVolume)
inline

◆ setLightProfilesTexture()

void Ogre::HlmsPbs::setLightProfilesTexture ( TextureGpu lightProfilesTex)

◆ 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.

◆ setMaxNonCasterDirectionalLights()

void Ogre::Hlms::setMaxNonCasterDirectionalLights ( uint16  maxLights)
inherited

Non-caster directional lights are hardcoded into shaders.

This means that if you have 6 directional lights and then you add a 7th one, a whole new set of shaders will be created.

This setting allows you to tremendously reduce the amount of shader permutations by forcing Ogre to switching to static branching with an upper limit to the max number of non-shadow-casting directional lights.

There is no such switch for shadow-casting directional/point/spot lights because of technical limitations at the GPU level (cannot index shadow map textures in DX11, nor samplers in any known GPU).

See also
setAreaLightForwardSettings
Parameters
maxLightsMaximum number of non-caster directional lights. 0 to allow unlimited number of lights, at the cost of shader recompilations when directional lights are added or removed.

Default value is 0.

Note: There is little to no performance impact for setting this value higher than you need. e.g. If you set maxLights = 4, but you only have 2 non-caster dir. lights on scene, you'll pay the price of 2 lights (but the RAM price of 4).

Beware of setting this value too high (e.g. 65535) as the amount of memory space is limited (we cannot exceed 64kb, including unrelated data to lighting, but required to the pass)

◆ setOptimizationStrategy()

virtual void Ogre::ConstBufferPool::setOptimizationStrategy ( OptimizationStrategy  optimizationStrategy)
virtualinherited

Sets the optimization strategy.

See OptimizationStrategy.

Remarks
Changing the optimization strategy on the fly will trigger a massive shader recompilation.
Implementations that don't support different strategies can overload this function.

Reimplemented in Ogre::HlmsUnlit.

◆ setParallaxCorrectedCubemap()

void Ogre::HlmsPbs::setParallaxCorrectedCubemap ( ParallaxCorrectedCubemapBase pcc,
float  pccVctMinDistance = 1.0f,
float  pccVctMaxDistance = 2.0f 
)

Sets PCC.

Remarks
PCC is a crude approximation of reflections that works best when the shape of the objects in the scene resemble the rectangle shape set by the PCC probe(s).

But when they do not, severe distortion could happen.

When both VCT and PCC are active, VCT can be used to determine whether the PCC approximation is accurate. If it is, it uses the PCC result. If it's not, it uses the VCT one (which is accurate but more 'blocky' due to voxelization)

This setting determines how much deviation is allowed and smoothly transition between the VCT and PCC results.

This value only affects specular reflections. For diffuse GI, VCT is always preferred over the cubemap's.

Parameters
pccPointer to PCC
pccVctMinDistanceValue in units (e.g. meters, centimeters, whatever your engine uses) Any discrepancy between PCC and VCT below this threshold means PCC reflections will be used.

The assertion pccVctMinDistance < pccVctMaxDistance must be true. Use a very high pccVctMinDistance to always use PCC

Parameters
pccVctMaxDistanceValue in units (e.g. meters, centimeters, whatever your engine uses) Any discrepancy between PCC and VCT above this threshold means VCT reflections will be used.

Errors between pccVctMinDistance & pccVctMaxDistance will be faded smoothly Use negative pccVctMaxDistance to always use VCT

◆ setPerceptualRoughness()

void Ogre::HlmsPbs::setPerceptualRoughness ( bool  bPerceptualRoughness)

Toggle whether the roughness value (set via material parameters and via roughness textures) is perceptual or raw.

Ogre 2.1 and 2.2.0 used raw roughness
Ogre 2.2.1+ default to perceptual roughness to better match the output of other PBR tools

If you're porting from Ogre 2.1 you may want to disable this feature unless if you want your materials to look exactly how they did in 2.2.0 and 2.1

See https://forums.ogre3d.org/viewtopic.php?f=25&t=95523

Parameters
bPerceptualRoughnessTrue to enable perceptual roughess (default) False to use raw roughess (Ogre 2.1's behavior)

◆ setProperty()

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

Utility helper, mostly useful to HlmsListener implementations.

◆ setShadowSettings()

void Ogre::HlmsPbs::setShadowSettings ( ShadowFilter  filter)

◆ setTextureBufferDefaultSize()

void Ogre::HlmsBufferManager::setTextureBufferDefaultSize ( size_t  defaultSize)
inherited

Changes the default suggested size for the texture buffer.

Actual size may be lower if the GPU can't honour the request.

◆ setUseLightBuffers()

void Ogre::HlmsPbs::setUseLightBuffers ( bool  b)

◆ setVctFullConeCount()

void Ogre::HlmsPbs::setVctFullConeCount ( bool  vctFullConeCount)
inline

When false, we will use 4 cones for diffuse VCT.

When true, we will use 6 cones instead. This is higher quality but consumes more performance and is usually overkill (benefit / cost ratio).

Default value is false

Parameters
vctFullConeCount

◆ setVctLighting()

void Ogre::HlmsPbs::setVctLighting ( VctLighting vctLighting)
inline

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