Documentation for module: Graphics
Former-commit-id: 1757c33318443aade1dc38e16d053240d7dc885c
This commit is contained in:
@@ -23,7 +23,7 @@ namespace Nz
|
||||
"User"
|
||||
};
|
||||
|
||||
static_assert(sizeof(techniquesName)/sizeof(const char*) == RenderTechniqueType_Max+1, "Render technique type name array is incomplete");
|
||||
static_assert(sizeof(techniquesName) / sizeof(const char*) == RenderTechniqueType_Max + 1, "Render technique type name array is incomplete");
|
||||
|
||||
struct RenderTechnique
|
||||
{
|
||||
@@ -34,6 +34,22 @@ namespace Nz
|
||||
std::unordered_map<String, RenderTechnique> s_renderTechniques;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup graphics
|
||||
* \class Nz::RenderTechniques
|
||||
* \brief Graphics class that represents the techniques used in rendering
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Gets the technique by enumeration
|
||||
* \return A reference to the newly created technique
|
||||
*
|
||||
* \param renderTechnique Enumeration of the technique
|
||||
* \param techniqueRanking Ranking for the technique
|
||||
*
|
||||
* \remark Produces a NazaraError if renderTechnique does not exist
|
||||
*/
|
||||
|
||||
AbstractRenderTechnique* RenderTechniques::GetByEnum(RenderTechniqueType renderTechnique, int* techniqueRanking)
|
||||
{
|
||||
#ifdef NAZARA_DEBUG
|
||||
@@ -47,6 +63,16 @@ namespace Nz
|
||||
return GetByName(techniquesName[renderTechnique], techniqueRanking);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the technique by index
|
||||
* \return A reference to the newly created technique
|
||||
*
|
||||
* \param index Index of the technique
|
||||
* \param techniqueRanking Ranking for the technique
|
||||
*
|
||||
* \remark Produces a NazaraError if index is out or range
|
||||
*/
|
||||
|
||||
AbstractRenderTechnique* RenderTechniques::GetByIndex(unsigned int index, int* techniqueRanking)
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
@@ -66,6 +92,16 @@ namespace Nz
|
||||
return it->second.factory();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the technique by name
|
||||
* \return A reference to the newly created technique
|
||||
*
|
||||
* \param name Name of the technique
|
||||
* \param techniqueRanking Ranking for the technique
|
||||
*
|
||||
* \remark Produces a NazaraError if name does not exist or is invalid
|
||||
*/
|
||||
|
||||
AbstractRenderTechnique* RenderTechniques::GetByName(const String& name, int* techniqueRanking)
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
@@ -89,6 +125,16 @@ namespace Nz
|
||||
return it->second.factory();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the technique by ranking
|
||||
* \return A reference to the newly created technique
|
||||
*
|
||||
* \param maxRanking Ranking maximum of the technique
|
||||
* \param techniqueRanking Ranking for the technique
|
||||
*
|
||||
* \remark Produces a NazaraError if name does not exist or is invalid
|
||||
*/
|
||||
|
||||
AbstractRenderTechnique* RenderTechniques::GetByRanking(int maxRanking, int* techniqueRanking)
|
||||
{
|
||||
if (maxRanking < 0)
|
||||
@@ -119,11 +165,28 @@ namespace Nz
|
||||
return technique->factory();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the number of techniques available
|
||||
* \return Number of techniques
|
||||
*/
|
||||
|
||||
unsigned int RenderTechniques::GetCount()
|
||||
{
|
||||
return s_renderTechniques.size();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Registers a technique
|
||||
*
|
||||
* \param name Name of the technique
|
||||
* \param ranking Ranking of the technique
|
||||
* \param factory Factory to create the technique
|
||||
*
|
||||
* \remark Produces a NazaraError with NAZARA_GRAPHICS_SAFE defined if name is empty
|
||||
* \remark Produces a NazaraError with NAZARA_GRAPHICS_SAFE defined if ranking is negative
|
||||
* \remark Produces a NazaraError with NAZARA_GRAPHICS_SAFE defined if factory is invalid is invalid
|
||||
*/
|
||||
|
||||
void RenderTechniques::Register(const String& name, int ranking, RenderTechniqueFactory factory)
|
||||
{
|
||||
#if NAZARA_GRAPHICS_SAFE
|
||||
@@ -149,6 +212,15 @@ namespace Nz
|
||||
s_renderTechniques[name] = {factory, ranking};
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Converts the enumeration to string
|
||||
* \return String symbolizing the technique
|
||||
*
|
||||
* \param renderTechnique Enumeration of the technique
|
||||
*
|
||||
* \remark Produces a NazaraError if renderTechnique does not exist and returns "Error"
|
||||
*/
|
||||
|
||||
String RenderTechniques::ToString(RenderTechniqueType renderTechnique)
|
||||
{
|
||||
#ifdef NAZARA_DEBUG
|
||||
@@ -162,6 +234,12 @@ namespace Nz
|
||||
return techniquesName[renderTechnique];
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Unregisters a technique
|
||||
*
|
||||
* \param name Name of the technique
|
||||
*/
|
||||
|
||||
void RenderTechniques::Unregister(const String& name)
|
||||
{
|
||||
s_renderTechniques.erase(name);
|
||||
|
||||
Reference in New Issue
Block a user