Radium Engine  1.5.20
Loading...
Searching...
No Matches
DirLight.hpp
1#pragma once
2
3#include <Engine/RaEngine.hpp>
4#include <Engine/Scene/Light.hpp>
5
6namespace Ra {
7namespace Engine {
8namespace Scene {
9
10class Entity;
11
15class RA_ENGINE_API DirectionalLight final : public Ra::Engine::Scene::Light
16{
17 public:
18 explicit DirectionalLight( Entity* entity, const std::string& name = "dirlight" );
19 ~DirectionalLight() override = default;
20
21 void setDirection( const Eigen::Matrix<Scalar, 3, 1>& dir ) override;
22 inline const Eigen::Matrix<Scalar, 3, 1>& getDirection() const;
23
24 std::string getShaderInclude() const override;
25
26 private:
27 Eigen::Matrix<Scalar, 3, 1> m_direction { 0, -1, 0 };
28};
29
30// ---------------------------------------------------------------------------------------------
31// ---- inline methods implementation
32
33inline void DirectionalLight::setDirection( const Eigen::Matrix<Scalar, 3, 1>& dir ) {
34 m_direction = dir.normalized();
35 getRenderParameters().setVariable( "light.directional.direction", m_direction );
36}
37
38inline const Eigen::Matrix<Scalar, 3, 1>& DirectionalLight::getDirection() const {
39 return m_direction;
40}
41
42} // namespace Scene
43} // namespace Engine
44} // namespace Ra
void setVariable(const std::string &name, RenderParameters &rp)
overload create ref wrapper for RenderParameters variable
void setDirection(const Eigen::Matrix< Scalar, 3, 1 > &dir) override
Definition DirLight.hpp:33
An entity is an scene element. It ties together components with a transform.
Definition Entity.hpp:23
const Data::RenderParameters & getRenderParameters() const
Gives read-only access to the renderParameters of the light.
Definition Light.hpp:93
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:3