Nameless Engine
|
#include <RenderSettings.h>
Public Member Functions | |
void | setFpsLimit (unsigned int iNewFpsLimit) |
void | setShadowQuality (ShadowQuality quality) |
void | setAntialiasingQuality (AntialiasingQuality quality) |
void | setTextureFilteringQuality (TextureFilteringQuality quality) |
void | setTextureQuality (TextureQuality quality) |
void | setRenderResolution (std::pair< unsigned int, unsigned int > resolution) |
void | setVsyncEnabled (bool bEnableVsync) |
void | setRefreshRate (std::pair< unsigned int, unsigned int > refreshRate) |
void | setGpuToUse (const std::string &sGpuName) |
void | setPreferredRenderer (RendererType preferredRenderer) |
unsigned int | getFpsLimit () const |
AntialiasingQuality | getAntialiasingQuality () const |
ShadowQuality | getShadowQuality () const |
std::variant< AntialiasingQuality, Error > | getMaxSupportedAntialiasingQuality () const |
TextureFilteringQuality | getTextureFilteringQuality () const |
TextureQuality | getTextureQuality () const |
std::pair< unsigned int, unsigned int > | getRenderResolution () const |
bool | isVsyncEnabled () const |
std::pair< unsigned int, unsigned int > | getRefreshRate () const |
std::string | getGpuToUse () const |
Public Member Functions inherited from ne::Serializable | |
std::optional< Error > | serialize (std::filesystem::path pathToFile, bool bEnableBackup, const std::unordered_map< std::string, std::string > &customAttributes={}) |
std::variant< std::string, Error > | serialize (toml::value &tomlData, const std::string &sEntityId="", const std::unordered_map< std::string, std::string > &customAttributes={}, const std::optional< std::filesystem::path > &optionalPathToFile={}, bool bEnableBackup=false) |
std::variant< std::string, Error > | serialize (toml::value &tomlData, Serializable *pOriginalObject, std::string sEntityId="", const std::unordered_map< std::string, std::string > &customAttributes={}, const std::optional< std::filesystem::path > &optionalPathToFile={}, bool bEnableBackup=false) |
std::optional< std::pair< std::string, std::string > > | getPathDeserializedFromRelativeToRes () const |
Static Public Member Functions | |
static std::filesystem::path | getPathToConfigurationFile () |
Static Public Member Functions inherited from ne::Serializable | |
static std::variant< std::pair< std::set< std::string >, toml::value >, Error > | getIdsFromFile (std::filesystem::path pathToFile) |
static std::optional< Error > | serializeMultiple (std::filesystem::path pathToFile, std::vector< SerializableObjectInformation > vObjects, bool bEnableBackup) |
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type> requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>) | |
static std::variant< SmartPointer, Error > | deserialize (const std::filesystem::path &pathToFile) |
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type> requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>) | |
static std::variant< SmartPointer, Error > | deserialize (const std::filesystem::path &pathToFile, std::unordered_map< std::string, std::string > &customAttributes) |
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type> requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>) | |
static std::variant< SmartPointer, Error > | deserialize (std::filesystem::path pathToFile, std::unordered_map< std::string, std::string > &customAttributes, const std::string &sEntityId) |
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type> requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>) | |
static std::variant< SmartPointer, Error > | deserialize (const std::filesystem::path &pathToFile, const std::string &sEntityId) |
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type> requires std::same_as<SmartPointer, sgc::GcPtr<Serializable>> || std::same_as<SmartPointer, std::unique_ptr<Serializable>> | |
static std::variant< std::vector< DeserializedObjectInformation< SmartPointer > >, Error > | deserializeMultiple (std::filesystem::path pathToFile) |
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type> requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>) | |
static std::variant< SmartPointer, Error > | deserialize (const toml::value &tomlData, std::unordered_map< std::string, std::string > &customAttributes, std::string sEntityId="", const std::optional< std::filesystem::path > &optionalPathToFile={}) |
Protected Member Functions | |
virtual void | onAfterDeserialized () override |
virtual void | onAfterDeserialized () |
Private Member Functions | |
void | setRenderer (Renderer *pRenderer) |
std::optional< Error > | clampSettingsToMaxSupported () |
std::optional< Error > | saveConfigurationToDisk () |
void | notifyRendererAboutChangedSettings (bool bShadowMapSizeChanged=false) |
Static Private Member Functions | |
static std::string | getConfigurationFileName (bool bIncludeFileExtension) |
Private Attributes | |
unsigned int | iRenderResolutionWidth = 0 |
unsigned int | iRenderResolutionHeight = 0 |
unsigned int | iRefreshRateNumerator = 0 |
unsigned int | iRefreshRateDenominator = 0 |
unsigned int | iFpsLimit = 0 |
std::string | sGpuToUse |
unsigned int | iRendererType = 0 |
unsigned int | iShadowMapSize = static_cast<unsigned int>(ShadowQuality::HIGH) |
unsigned int | iAntialiasingSampleCount = static_cast<unsigned int>(AntialiasingQuality::HIGH) |
unsigned int | iTextureFilteringQuality = static_cast<unsigned int>(TextureFilteringQuality::HIGH) |
unsigned int | iTextureQuality = static_cast<unsigned int>(TextureQuality::VERY_HIGH) |
bool | bIsVsyncEnabled = false |
Renderer * | pRenderer = nullptr |
bool | bAllowSavingConfigurationToDisk = false |
Static Private Attributes | |
static const char * | sRenderSettingsConfigurationFileName = "render" |
Friends | |
class | Renderer |
Controls renderer settings.
|
private |
Called by the renderer when it has finished initializing its essential entities so that RenderSettings can query maximum supported settings and clamp the current values (if needed).
AntialiasingQuality ne::RenderSettings::getAntialiasingQuality | ( | ) | const |
Returns current anti-aliasing (AA) quality.
DISABLED
if AA is not supported (see getMaxSupportedAntialiasingQuality), otherwise current AA quality.
|
staticprivate |
Returns name of the file that is used to store setting configuration.
bIncludeFileExtension | Whether to include file extension in the returned string or not. |
unsigned int ne::RenderSettings::getFpsLimit | ( | ) | const |
Returns the maximum number of FPS that is allowed to be produced in a second.
std::string ne::RenderSettings::getGpuToUse | ( | ) | const |
Returns name of the GPU to use.
Renderer::getCurrentlyUsedGpuName
.std::variant< AntialiasingQuality, Error > ne::RenderSettings::getMaxSupportedAntialiasingQuality | ( | ) | const |
Returns the maximum anti-aliasing quality that can be used on the picked GPU (see Renderer::getCurrentlyUsedGpuName
).
DISABLED
if AA is not supported or the maximum supported AA quality.
|
static |
Returns path to the file that is used to store setting configuration.
std::pair< unsigned int, unsigned int > ne::RenderSettings::getRefreshRate | ( | ) | const |
Returns currently used screen's refresh rate.
std::pair< unsigned int, unsigned int > ne::RenderSettings::getRenderResolution | ( | ) | const |
Returns currently used render resolution (width and height).
ShadowQuality ne::RenderSettings::getShadowQuality | ( | ) | const |
Returns current shadow quality.
TextureFilteringQuality ne::RenderSettings::getTextureFilteringQuality | ( | ) | const |
Returns currently used texture filtering quality.
TextureQuality ne::RenderSettings::getTextureQuality | ( | ) | const |
Returns currently used texture quality.
bool ne::RenderSettings::isVsyncEnabled | ( | ) | const |
Tells if vertical synchronization is currently enabled or not.
|
private |
Notifies the renderer to change its internal state to match the current settings.
bShadowMapSizeChanged | true if shadow map size was changed, false otherwise. |
|
overrideprotectedvirtual |
Called after the object was successfully deserialized. Used to execute post-deserialization logic.
Reimplemented from ne::Serializable.
|
private |
Saves the current configuration to disk.
false
.void ne::RenderSettings::setAntialiasingQuality | ( | AntialiasingQuality | quality | ) |
Sets anti-aliasing (AA) quality.
quality | AA quality. |
void ne::RenderSettings::setFpsLimit | ( | unsigned int | iNewFpsLimit | ) |
Sets the maximum number of FPS that is allowed to be produced in a second.
iNewFpsLimit | Maximum allowed FPS, specify 0 to disable. |
void ne::RenderSettings::setGpuToUse | ( | const std::string & | sGpuName | ) |
Sets GPU to be used next time the engine starts.
sGpuName | Name of the GPU to use. |
void ne::RenderSettings::setPreferredRenderer | ( | RendererType | preferredRenderer | ) |
Changes renderer's config file setting about preferred renderer.
preferredRenderer | Renderer to prefer (test the first one) next time the game is started. |
void ne::RenderSettings::setRefreshRate | ( | std::pair< unsigned int, unsigned int > | refreshRate | ) |
Sets screen's refresh rate to use.
refreshRate | Numerator and denominator of the refresh rate to use. |
|
private |
Sets renderer to be used.
pRenderer | Game's renderer. |
void ne::RenderSettings::setRenderResolution | ( | std::pair< unsigned int, unsigned int > | resolution | ) |
Sets the width and the height of the render resolution.
Renderer::getSupportedRenderResolutions
to query for available render resolutions.resolution | Width and height in pixels. |
void ne::RenderSettings::setShadowQuality | ( | ShadowQuality | quality | ) |
Sets shadow quality.
quality | Quality to use. |
void ne::RenderSettings::setTextureFilteringQuality | ( | TextureFilteringQuality | quality | ) |
Sets texture filtering quality to be used.
quality | Quality to use. |
void ne::RenderSettings::setTextureQuality | ( | TextureQuality | quality | ) |
Sets texture quality to be used.
quality | Quality to use. |
void ne::RenderSettings::setVsyncEnabled | ( | bool | bEnableVsync | ) |
Sets whether to enable vertical synchronization or not.
bEnableVsync | Whether to enable vertical synchronization or not. |
|
private |
Defines whether or not changes to render settings trigger saving on disk.
|
private |
Whether VSync is enabled or not.
|
private |
Sample count of AA.
|
private |
The maximum number of FPS that is allowed to be produced in a second.
|
private |
Denominator of screen's refresh rate.
|
private |
Numerator of screen's refresh rate.
|
private |
Stored used type of the renderer (DirectX/Vulkan/etc.).
|
private |
Height of the back buffer.
|
private |
Width of the back buffer.
|
private |
Shadow map resolution in pixels.
|
private |
Texture filtering mode.
|
private |
Defines how much mipmaps we will skip when loading textures from disk.
|
private |
Do not delete (free) this pointer. Game's renderer.
|
private |
Name of the GPU to use.
|
inlinestaticprivate |
Name of the file we use to store render settings.