Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
PointLight.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "FlingMath.h"
4 #include <cereal/archives/json.hpp>
5 
6 namespace Fling
7 {
12  struct alignas(16) PointLight
13  {
14  public:
19  glm::vec4 DiffuseColor { 1.0f };
20 
21  private:
25  glm::vec4 Pos { 0.0f };
26  public:
27  alignas(4) float Intensity = 10.0f;
28  alignas(4) float Range = 5.0f;
29 
30  template<class Archive>
31  void serialize(Archive & t_Archive);
32 
33  FORCEINLINE void SetPos(const glm::vec4& t_Pos) { Pos = t_Pos; }
34  };
35 
37  template<class Archive>
38  void PointLight::serialize(Archive & t_Archive)
39  {
40  t_Archive(
41 
42  cereal::make_nvp("DIFFUSE_X", DiffuseColor.x),
43  cereal::make_nvp("DIFFUSE_Y", DiffuseColor.y),
44  cereal::make_nvp("DIFFUSE_Z", DiffuseColor.z),
45 
46  cereal::make_nvp("RANGE", Range),
47  cereal::make_nvp("INTENSITY", Intensity)
48  );
49  }
50 } // namespace Fling
float Intensity
Definition: PointLight.hpp:27
void serialize(Archive &t_Archive)
Serilazation to an archive.
Definition: PointLight.hpp:38
Simple representation of a point light in Light Vox.
Definition: PointLight.hpp:12
glm::vec4 Pos
The position of this point light will be set from it&#39;s Transform component.
Definition: PointLight.hpp:25
FORCEINLINE void SetPos(const glm::vec4 &t_Pos)
Definition: PointLight.hpp:33
glm::vec4 DiffuseColor
Diffuse color of this point light, RBA on a scale of 0.0 to 1.0.
Definition: PointLight.hpp:19
Definition: Engine.h:29
float Range
Definition: PointLight.hpp:28