PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
spot_light_component.h
1#pragma once
2
3#include "pixelbullet/serialization/glm_node.h"
4
5namespace pixelbullet
6{
8{
9 bool enabled = true;
10 glm::vec3 color = glm::vec3(1.0f);
11 float intensity = 1.0f;
12 float range = 5.0f;
13 float inner_cone_angle_degrees = 0.0f;
14 float outer_cone_angle_degrees = 45.0f;
15};
16
17inline Node& operator<<(Node& node, const SpotLightComponent& light)
18{
19 node["enabled"] << light.enabled;
20 node["color"] << light.color;
21 node["intensity"] << light.intensity;
22 node["range"] << light.range;
23 node["innerConeAngleDegrees"] << light.inner_cone_angle_degrees;
24 node["outerConeAngleDegrees"] << light.outer_cone_angle_degrees;
25 return node;
26}
27
28inline const Node& operator>>(const Node& node, SpotLightComponent& light)
29{
30 node["enabled"] >> light.enabled;
31 node["color"] >> light.color;
32 node["intensity"] >> light.intensity;
33 node["range"] >> light.range;
34 if (node.HasProperty("innerConeAngleDegrees"))
35 {
36 node["innerConeAngleDegrees"] >> light.inner_cone_angle_degrees;
37 }
38 if (node.HasProperty("outerConeAngleDegrees"))
39 {
40 node["outerConeAngleDegrees"] >> light.outer_cone_angle_degrees;
41 }
42 return node;
43}
44} // namespace pixelbullet
Represents a hierarchical node capable of storing various data types and supporting YAML serializatio...
Definition node.h:45
Definition spot_light_component.h:8