Reworked material
This commit is contained in:
parent
5c51de37a6
commit
bf751c6c69
12 changed files with 251 additions and 32 deletions
|
@ -1,3 +1,10 @@
|
|||
/*****************************************************************//**
|
||||
* @file ambient.hpp
|
||||
* @brief Anything related to ambient/environmental lighting
|
||||
*
|
||||
* @author Lauchmelder
|
||||
* @date January 2021
|
||||
*********************************************************************/
|
||||
#ifndef AMBIENT_HPP
|
||||
#define AMBIENT_HPP
|
||||
|
||||
|
@ -6,16 +13,46 @@
|
|||
|
||||
namespace oglu
|
||||
{
|
||||
/**
|
||||
* @brief A class holding information needed for ambient lighting.
|
||||
*/
|
||||
class OGLU_API AmbientLight
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Create default ambient light.
|
||||
*
|
||||
* By default, this creates a white light at full intensity
|
||||
*/
|
||||
AmbientLight();
|
||||
|
||||
/**
|
||||
* @brief Create a custom ambient light.
|
||||
*
|
||||
* @param r Red component
|
||||
* @param r Green component
|
||||
* @param r Blue component
|
||||
* @param intensity Intensity of the lighting
|
||||
*/
|
||||
AmbientLight(GLfloat r, GLfloat g, GLfloat b, GLfloat intensity);
|
||||
|
||||
/**
|
||||
* @brief Create a custom ambient light.
|
||||
*
|
||||
* @param color Color of the lighting
|
||||
* @param intensity Intensity of the lighting
|
||||
*/
|
||||
AmbientLight(const Color& color, GLfloat intensity);
|
||||
|
||||
/**
|
||||
* @brief Copy another ambient light.
|
||||
*
|
||||
* @param other The light to copy from
|
||||
*/
|
||||
AmbientLight(const AmbientLight& other);
|
||||
|
||||
GLfloat intensity;
|
||||
Color color;
|
||||
GLfloat intensity; ///< Intensity of the ambient light
|
||||
Color color; ///< Color of the ambient light
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*****************************************************************//**
|
||||
* @file point.hpp
|
||||
* @brief Anything related to point light sources
|
||||
*
|
||||
* @author Lauchmelder
|
||||
* @date January 2021
|
||||
*********************************************************************/
|
||||
#ifndef POINT_HPP
|
||||
#define POINT_HPP
|
||||
|
||||
|
@ -9,27 +16,74 @@ namespace oglu
|
|||
{
|
||||
class Transformable;
|
||||
|
||||
/**
|
||||
* @brief A class containing things related to point lighting.
|
||||
*/
|
||||
class OGLU_API PointLight
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Create a default point light.
|
||||
*
|
||||
* By default the diffusion and specular components are white and
|
||||
* the light is positioned at the world origin
|
||||
*/
|
||||
PointLight();
|
||||
|
||||
/**
|
||||
* @brief Create a new point light.
|
||||
*
|
||||
* @param position Position of the light
|
||||
* @param diffusionColor Color of the diffusion component
|
||||
* @param specularColor Color of the specular component
|
||||
*/
|
||||
PointLight(const glm::vec3& position, const Color& diffusionColor = Color::White, const Color& specularColor = Color::White);
|
||||
|
||||
/**
|
||||
* @brief Copy from another point light.
|
||||
*
|
||||
* @param other The point light to copy from
|
||||
*/
|
||||
PointLight(const PointLight& other);
|
||||
|
||||
~PointLight();
|
||||
|
||||
/**
|
||||
* @brief Link the lights position to a Transformable.
|
||||
*
|
||||
* It is possible to link the positions of a Transformable and
|
||||
* a PointLight. This means that these two objects will always
|
||||
* have the same position, until they are unlinked. Deleting a
|
||||
* Transformable before unlinking any linked PointLight causes
|
||||
* undefined behaviour.
|
||||
*
|
||||
* @param link The Transformable to link to
|
||||
*/
|
||||
void LinkPositionToTransformable(Transformable& link);
|
||||
|
||||
/**
|
||||
* @brief Unlink a Transformable.
|
||||
*
|
||||
* This breaks the link between the two objects.
|
||||
*/
|
||||
void UnlinkPositionFromTransformable();
|
||||
|
||||
/**
|
||||
* Get the lights position.
|
||||
*
|
||||
* @returns A pointer to the lights position
|
||||
*/
|
||||
float* GetPositionPointer();
|
||||
|
||||
public:
|
||||
Color diffusionColor;
|
||||
Color specularColor;
|
||||
// TODO: Does this split make sense? I'll keep it for now
|
||||
Color diffusionColor; ///< Diffusion color of the light
|
||||
Color specularColor; ///< Specular color of the light
|
||||
|
||||
|
||||
private:
|
||||
glm::vec3* position;
|
||||
bool isLinked;
|
||||
glm::vec3* position; ///< Position of the light
|
||||
bool isLinked; ///< Wether the position is linked to an object or not
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue