![]() |
OGRE
2.1.0unstable
Object-Oriented Graphics Rendering Engine
|
Implementation without lighting or skeletal animation specfically designed for OpenGL 3+, D3D11 and other RenderSystems which support uniform buffers. More...
#include <OgreHlmsUnlit.h>
Public Types | |
typedef std::map< IdString, DatablockEntry > | HlmsDatablockMap |
typedef vector< Library >::type | LibraryVec |
enum | LightGatheringMode { LightGatherForward, LightGatherForwardPlus, LightGatherDeferred, LightGatherNone } |
enum | OptimizationStrategy { LowerCpuOverhead, LowerGpuOverhead } |
Public Member Functions | |
HlmsUnlit (Archive *dataFolder, ArchiveVec *libraryFolders) | |
HlmsUnlit (Archive *dataFolder, ArchiveVec *libraryFolders, HlmsTypes type, const String &typeName) | |
virtual | ~HlmsUnlit () |
virtual void | _changeRenderSystem (RenderSystem *newRs) |
void | _clearShaderCache (void) |
virtual void | _collectSamplerblocks (set< const HlmsSamplerblock *>::type &outSamplerblocks, const HlmsDatablock *datablock) 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. More... | |
void | _notifyBlendblockDestroyed (uint16 id) |
When a macroblock is destroyed, the PSO is no longer valid. More... | |
void | _notifyInputLayoutDestroyed (uint16 id) |
When a macroblock is destroyed, the PSO is no longer valid. More... | |
void | _notifyMacroblockDestroyed (uint16 id) |
When a macroblock is destroyed, the PSO is no longer valid. More... | |
void | _notifyManager (HlmsManager *manager) |
void | _notifyShadowMappingBackFaceSetting (void) |
Internal use. More... | |
void | _notifyV1InputLayoutDestroyed (uint16 id) |
When a macroblock is destroyed, the PSO is no longer valid. 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... | |
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. More... | |
HlmsDatablock * | createDatablock (IdString name, const String &refName, const HlmsMacroblock ¯oblockRef, const HlmsBlendblock &blendblockRef, const HlmsParamVec ¶mVec, 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... | |
uint16 | getAreaLightsLimit (void) const |
uint8 | getAreaLightsRoundMultiple (void) const |
HlmsDatablock * | getDatablock (IdString name) const |
Finds an existing datablock based on its name (. More... | |
const HlmsDatablockMap & | getDatablockMap (void) const |
Returns all datablocks owned by this Hlms, including the default one. More... | |
Archive * | getDataFolder (void) |
HlmsDatablock * | getDefaultDatablock (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 | getHighQuality (void) const |
HlmsManager * | getHlmsManager (void) const |
HlmsListener * | getListener (void) const |
Returns the current listener. More... | |
const HlmsCache * | getMaterial (HlmsCache const *lastReturnedValue, const HlmsCache &passCache, const QueuedRenderable &queuedRenderable, uint8 inputLayout, bool casterPass) |
Retrieves an HlmsCache filled with the GPU programs to be used by the given renderable. More... | |
const String * | getNameStr (IdString name) const |
Returns the string name associated with its hashed name (this was passed as refName in ). More... | |
OptimizationStrategy | getOptimizationStrategy () const |
const LibraryVec & | getPiecesLibrary (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... | |
RenderSystem * | getRenderSystem (void) const |
bool | getShadowFilter (void) const |
HlmsTypes | getType (void) const |
IdString | getTypeName (void) const |
const String & | getTypeNameStr (void) const |
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 | saveAllTexturesFromDatablocks (const String &folderPath, set< String >::type &savedTextures, bool saveOitd, bool saveOriginal, HlmsTextureExportListener *listener) |
void | scheduleForUpdate (ConstBufferPoolUser *dirtyUser) |
void | setAreaLightForwardSettings (uint16 areaLightsLimit, uint8 areaLightsRoundMultiple) |
Area lights use regular Forward. More... | |
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 | setEsmK (uint16 K) |
Sets the 'K' parameter of ESM filter. More... | |
void | setHighQuality (bool highQuality) |
Sets the quality of the Hlms. More... | |
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... | |
virtual void | setOptimizationStrategy (OptimizationStrategy optimizationStrategy) |
Not supported. More... | |
void | setShadowSettings (bool useExponentialShadowMaps) |
void | setTextureBufferDefaultSize (size_t defaultSize) |
Changes the default suggested size for the texture buffer. More... | |
Static Public Member Functions | |
static bool | findParamInVec (const HlmsParamVec ¶mVec, 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... | |
Implementation without lighting or skeletal animation specfically designed for OpenGL 3+, D3D11 and other RenderSystems which support uniform buffers.
Useful for GUI, ParticleFXs, other misc objects that don't require lighting.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Ogre::HlmsUnlit::HlmsUnlit | ( | Archive * | dataFolder, |
ArchiveVec * | libraryFolders | ||
) |
Ogre::HlmsUnlit::HlmsUnlit | ( | Archive * | dataFolder, |
ArchiveVec * | libraryFolders, | ||
HlmsTypes | type, | ||
const String & | typeName | ||
) |
|
virtual |
|
virtual |
Reimplemented from Ogre::ConstBufferPool.
|
inherited |
|
virtual |
Reimplemented from Ogre::Hlms.
|
virtual |
Loads datablock values from a JSON value.
jsonValue | JSON Object containing the definition of this datablock. |
blocks | All the loaded Macro-, Blend- & Samplerblocks the JSON has defined and may be referenced by the datablock declaration. |
datablock | Datablock to fill the values. |
Reimplemented from Ogre::Hlms.
|
inherited |
When a macroblock is destroyed, the PSO is no longer valid.
We need to destroy it. Otherwise when we try to reuse a macroblock with the same internal ID but different settings, the old (wrong) PSO will be used.
|
inherited |
When a macroblock is destroyed, the PSO is no longer valid.
We need to destroy it. Otherwise when we try to reuse a macroblock with the same internal ID but different settings, the old (wrong) PSO will be used.
|
inherited |
When a macroblock is destroyed, the PSO is no longer valid.
We need to destroy it. Otherwise when we try to reuse a macroblock with the same internal ID but different settings, the old (wrong) PSO will be used.
|
inlineinherited |
|
inherited |
Internal use.
|
inherited |
When a macroblock is destroyed, the PSO is no longer valid.
We need to destroy it. Otherwise when we try to reuse a macroblock with the same internal ID but different settings, the old (wrong) PSO will be used.
|
virtual |
Reimplemented from Ogre::Hlms.
For debugging stuff. I.e. the Command line uses it for testing manually set properties.
|
virtualinherited |
Called by the renderable when either it changes the material, or its properties change (e.g.
the mesh' uvs are stripped)
renderable | The renderable the material will be used on. |
movableObject | The MovableObject the material will be used on (usually the parent of renderable) |
Reimplemented in Ogre::HlmsLowLevel, and Ogre::HlmsUnlitMobile.
|
inherited |
Creates a unique datablock that can be shared by multiple renderables.
name | Name 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. |
refName | Name 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 | HlmsManager::getMacroblock |
blendblockRef | HlmsManager::getBlendblock |
paramVec | Key - String Value list of paramters. MUST BE SORTED. |
visibleToManager | When false, HlmsManager::getDatablock won't find this datablock. True by default |
filename | Filename in which it was defined, so that this information can be retrieved later by the user if needed. This is only for informational purposes. |
resourceGroup | ResourceGroup. See filename param. |
|
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.
|
inherited |
Destroys a datablocks given its name.
Caller is responsible for ensuring those pointers aren't still in use (i.e. dangling pointers)
|
virtual |
Fills the constant buffers.
Gets executed right before drawing the mesh.
cache | Current cache of Shaders to be used. |
queuedRenderable | The Renderable-MovableObject pair about to be rendered. |
casterPass | Whether this is a shadow mapping caster pass. |
lastCacheHash | The hash of the cache of shaders that was the used by the previous renderable. |
lastTextureHash | Last Texture Hash, used to let the Hlms know whether the textures should be changed again |
Implements Ogre::Hlms.
|
virtual |
Implements Ogre::Hlms.
|
virtual |
Implements Ogre::Hlms.
|
staticinherited |
Finds the parameter with key 'key' in the given 'paramVec'.
If found, outputs the value to 'inOut', otherwise leaves 'inOut' as is.
|
virtual |
Called when the frame has fully ended (ALL passes have been executed to all RTTs)
Reimplemented from Ogre::HlmsBufferManager.
|
inlineinherited |
|
inlineinherited |
|
inherited |
Finds an existing datablock based on its name (.
|
inlineinherited |
Returns all datablocks owned by this Hlms, including the default one.
|
inlineinherited |
|
inherited |
Datablock to use when another datablock failed or none was specified.
|
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.
outDataFolderPath | Path (as a String) used for creating the "dataFolder" Archive the constructor will need |
outLibraryFoldersPaths | Vector of String used for creating the ArchiveVector "libraryFolders" the constructor will need |
|
inline |
|
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. }
|
inlineinherited |
|
inlineinherited |
|
inherited |
Returns the current listener.
|
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.
lastReturnedValue | The last value returned by getMaterial. |
passCache | The cache returned by . |
renderable | The renderable the caller wants us to give the shaders. |
movableObject | The MovableObject owner of the renderable (we need it to know if renderable should cast shadows) |
casterPass | True if this pass is the shadow mapping caster pass, false otherwise |
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)
|
inherited |
|
inlineinherited |
References Ogre::BLANKSTRING.
|
inherited |
|
inherited |
Gets an ID corresponding to the pool this user was assigned to, unique per hash.
|
staticinherited |
Utility helper, mostly useful to HlmsListener implementations.
|
inlineinherited |
|
inline |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
operator new, with debug line info
|
inlineinherited |
|
inlineinherited |
placement operator new
|
inlineinherited |
array operator new, with debug line info
|
inlineinherited |
|
virtualinherited |
This gets called after executing the command buffer.
Reimplemented from Ogre::Hlms.
Reimplemented in Ogre::HlmsPbs.
|
virtualinherited |
This gets called right before executing the command buffer.
Reimplemented from Ogre::Hlms.
|
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
shadowNode | The shadow node currently in effect. Can be null. |
Reimplemented from Ogre::HlmsBufferManager.
|
inherited |
Releases a slot requested with requestSlot.
|
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.
libraryFolders | When 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.
|
inherited |
Requests a slot and fills 'user'. Automatically schedules for update.
|
inherited |
|
inherited |
|
inherited |
Area lights use regular Forward.
areaLightsLimit | Maximum number of area lights that will be considered by the shader. Default value is 1. Use 0 to disable area lights. |
areaLightsRoundMultiple | To 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.
|
inherited |
Call to output the automatically generated shaders (which are usually made from templates) on the given folder for inspection, analyzing, debugging, etc.
enableDebugOutput | Whether to enable or disable dumping the shaders into a folder |
outputProperties | Whether 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. |
path | Path 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) |
void Ogre::HlmsUnlit::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.
K | In range (0; infinite). |
|
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.
|
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.
listener | Listener pointer. Use null to disable. |
|
inlinevirtual |
Not supported.
Reimplemented from Ogre::ConstBufferPool.
void Ogre::HlmsUnlit::setShadowSettings | ( | bool | useExponentialShadowMaps | ) |
|
inherited |
Changes the default suggested size for the texture buffer.
Actual size may be lower if the GPU can't honour the request.