Added basis for point light

This commit is contained in:
Robert 2021-01-26 16:03:41 +01:00
parent 862ef6d34b
commit b51c5a7557
6 changed files with 105 additions and 6 deletions

View file

@ -0,0 +1,34 @@
#ifndef POINT_HPP
#define POINT_HPP
#include <core.hpp>
#include <color.hpp>
#include <glm/glm.hpp>
namespace oglu
{
class Transformable;
class OGLU_API PointLight
{
public:
PointLight();
PointLight(const glm::vec3& position, const Color& color);
PointLight(const PointLight& other);
~PointLight();
void LinkPositionToTransformable(Transformable& link);
void UnlinkPositionFromTransformable();
float* GetPositionPointer();
public:
Color color;
private:
glm::vec3* position;
bool isLinked;
};
}
#endif

View file

@ -16,6 +16,7 @@
#include <camera.hpp>
#include <lighting/ambient.hpp>
#include <lighting/point.hpp>
namespace oglu
{

View file

@ -15,6 +15,7 @@
namespace oglu
{
class PointLight;
/**
* @brief Defines position, rotation and scale.
*
@ -23,6 +24,9 @@ namespace oglu
*/
class OGLU_API Transformable
{
private:
friend class PointLight;
public:
/**
* @brief Create new identity transformation.
@ -349,7 +353,7 @@ namespace oglu
*
* @return An array of 16 floats representing the transformation matrix
*/
virtual const glm::mat4& GetMatrix();
virtual const glm::mat4& GetMatrix(bool forceRecalc = false);
/**
* @brief Returns a normal matrix.