Graphics: Add basic reflection mapping

This commit is contained in:
Lynix
2016-12-18 01:18:48 +01:00
parent 459c5e7a09
commit 37d36a89a6
10 changed files with 104 additions and 26 deletions

View File

@@ -146,7 +146,7 @@ namespace Nz
/*!
* \brief Enable/Disable alpha test for this material
*
* When enabled, all objects using this material will be rendered using alpha testing,
* When enabled, all objects using this material will be rendered using alpha testing,
* rejecting pixels if their alpha component is under a defined threshold.
* This allows some kind of transparency with a much cheaper cost as it doesn't prevent any optimization (as deferred rendering or batching).
*
@@ -252,7 +252,7 @@ namespace Nz
* When enabled, and if depth buffer is enabled and present, all fragments generated with this material will write
* to the depth buffer if they pass depth test.
*
* This is usually disabled with translucent objects, as depth test is wanted to prevent them from rendering on top of opaque objects but
* This is usually disabled with translucent objects, as depth test is wanted to prevent them from rendering on top of opaque objects but
* not depth writing (which could make other translucent fragments to fail depth test)
*
* \param depthBuffer Defines if this material will use depth write
@@ -291,6 +291,31 @@ namespace Nz
InvalidatePipeline();
}
/*!
* \brief Enable/Disable reflection mapping for this material
*
* When enabled, the material will render reflections from the object environment according to the reflection mode.
* Whether or not this is expensive depends of the reflection mode and size.
*
* Please note this is only a hint for the render technique, and reflections can be forcefully enabled or disabled depending on the material shader.
*
* Use SetReflectionMode and SetReflectionSize to control reflection quality.
*
* \param reflection Defines if this material should use reflection mapping
*
* \remark May invalidates the pipeline
*
* \see IsReflectionMappingEnabled
* \see SetReflectionMode
* \see SetReflectionSize
*/
inline void Material::EnableReflectionMapping(bool reflection)
{
m_pipelineInfo.reflectionMapping = reflection;
InvalidatePipeline();
}
/*!
* \brief Enable/Disable scissor test for this material
*
@@ -782,6 +807,17 @@ namespace Nz
return m_pipelineInfo.faceCulling;
}
/*!
* \brief Checks whether this material has reflection mapping enabled
* \return true If it is the case
*
* \see EnableReflectionMapping
*/
inline bool Material::IsReflectionMappingEnabled() const
{
return m_pipelineInfo.reflectionMapping;
}
/*!
* \brief Checks whether this material has scissor test enabled
* \return true If it is the case