Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
DirectionalLight.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) DirectionalLight
13  {
14  alignas(16) glm::vec4 DiffuseColor { 1.0f };
15  alignas(16) glm::vec4 Direction { 1.0f, -1.0f, -0.5f, 1.0f };
16  alignas(4) float Intensity = 1.0f;
17 
18  template<class Archive>
19  void serialize(Archive & t_Archive);
20  };
21 
23  template<class Archive>
24  void DirectionalLight::serialize(Archive & t_Archive)
25  {
26  t_Archive(
27  cereal::make_nvp("DIFFUSE_X", DiffuseColor.x),
28  cereal::make_nvp("DIFFUSE_Y", DiffuseColor.y),
29  cereal::make_nvp("DIFFUSE_Z", DiffuseColor.z),
30  cereal::make_nvp("DIFFUSE_W", DiffuseColor.w),
31 
32  cereal::make_nvp("DIRECTION_X", Direction.x),
33  cereal::make_nvp("DIRECTION_Y", Direction.y),
34  cereal::make_nvp("DIRECTION_Z", Direction.z),
35 
36  cereal::make_nvp("INTENSITY", Intensity)
37  );
38  }
39 } // namespace Fling
glm::vec4 Direction
Definition: DirectionalLight.hpp:15
Simple representation of a directional light for Fling.
Definition: DirectionalLight.hpp:12
glm::vec4 DiffuseColor
Definition: DirectionalLight.hpp:14
Definition: Engine.h:29
void serialize(Archive &t_Archive)
Serilazation to an archive.
Definition: DirectionalLight.hpp:24
float Intensity
Definition: DirectionalLight.hpp:16