Documentation for module: Graphics

Former-commit-id: 1757c33318443aade1dc38e16d053240d7dc885c
This commit is contained in:
Gawaboumga
2016-05-30 14:21:36 +02:00
parent 7721fd2284
commit 2c941827ed
94 changed files with 4858 additions and 504 deletions

View File

@@ -13,11 +13,23 @@
#include <cstring>
#include <Nazara/Graphics/Debug.hpp>
///TODO: Utilisation des UBOs
///TODO: Use of UBOs
///TODO: Scale ?
namespace Nz
{
/*!
* \ingroup graphics
* \class Nz::Light
* \brief Graphics class that represents a light
*/
/*!
* \brief Constructs a Light object with a type
*
* \param type Type of the light
*/
Light::Light(LightType type) :
m_type(type),
m_shadowMapFormat(PixelFormatType_Depth16),
@@ -34,6 +46,15 @@ namespace Nz
SetRadius(5.f);
}
/*!
* \brief Adds this light to the render queue
*
* \param renderQueue Queue to be added
* \param transformMatrix Matrix transformation for this light
*
* \remark Produces a NazaraError if type is invalid
*/
void Light::AddToRenderQueue(AbstractRenderQueue* renderQueue, const Matrix4f& transformMatrix) const
{
static Matrix4f biasMatrix(0.5f, 0.f, 0.f, 0.f,
@@ -100,16 +121,36 @@ namespace Nz
}
}
/*!
* \brief Clones this light
* \return Pointer to newly allocated Light
*/
Light* Light::Clone() const
{
return new Light(*this);
}
/*!
* \brief Creates a default light
* \return Pointer to newly allocated light
*/
Light* Light::Create() const
{
return new Light;
}
/*!
* \brief Culls the light if not in the frustum
* \return true If light is in the frustum
*
* \param frustum Symbolizing the field of view
* \param transformMatrix Matrix transformation for our object
*
* \remark Produces a NazaraError if type is invalid
*/
bool Light::Cull(const Frustumf& frustum, const Matrix4f& transformMatrix) const
{
switch (m_type)
@@ -128,6 +169,14 @@ namespace Nz
return false;
}
/*!
* \brief Updates the bounding volume by a matrix
*
* \param transformMatrix Matrix transformation for our bounding volume
*
* \remark Produces a NazaraError if type is invalid
*/
void Light::UpdateBoundingVolume(const Matrix4f& transformMatrix)
{
switch (m_type)
@@ -149,6 +198,12 @@ namespace Nz
}
}
/*
* \brief Makes the bounding volume of this light
*
* \remark Produces a NazaraError if type is invalid
*/
void Light::MakeBoundingVolume() const
{
switch (m_type)
@@ -166,19 +221,19 @@ namespace Nz
case LightType_Spot:
{
// On forme une boite sur l'origine
// We make a box center in the origin
Boxf box(Vector3f::Zero());
// On calcule le reste des points
Vector3f base(Vector3f::Forward()*m_radius);
// We compute the other points
Vector3f base(Vector3f::Forward() * m_radius);
// Il nous faut maintenant le rayon du cercle projeté à cette distance
// Tangente = Opposé/Adjaçent <=> Opposé = Adjaçent*Tangente
// Now we need the radius of the projected circle depending on the distance
// Tangent = Opposite/Adjacent <=> Opposite = Adjacent * Tangent
float radius = m_radius * m_outerAngleTangent;
Vector3f lExtend = Vector3f::Left()*radius;
Vector3f uExtend = Vector3f::Up()*radius;
Vector3f lExtend = Vector3f::Left() * radius;
Vector3f uExtend = Vector3f::Up() * radius;
// Et on ajoute ensuite les quatres extrémités de la pyramide
// And we add the four extremities of our pyramid
box.ExtendTo(base + lExtend + uExtend);
box.ExtendTo(base + lExtend - uExtend);
box.ExtendTo(base - lExtend + uExtend);
@@ -194,6 +249,10 @@ namespace Nz
}
}
/*!
* \brief Updates the shadow map
*/
void Light::UpdateShadowMap() const
{
if (m_shadowCastingEnabled)