Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
DirectionalLightComponent.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_DIRECTIONAL_LIGHT_COMPONENT_H_
34#define DVD_DIRECTIONAL_LIGHT_COMPONENT_H_
35
38
39namespace Divide {
40
42 public:
43 using PerSplitToggle = std::array<bool, Config::Lighting::MAX_CSM_SPLITS_PER_LIGHT>;
44
45 public:
46
47 explicit DirectionalLightComponent(SceneGraphNode* sgn, PlatformContext& context);
48
49 void setDirection(const vec3<F32>& direction);
50
51 // Quick hack to store previous frame's culling results
53
54 PROPERTY_RW(U8, csmSplitCount, 3u);
56 PROPERTY_RW(F32, csmNearClipOffset, 0.0f);
58 PROPERTY_RW(PerSplitToggle, csmUseSceneAABBFit, create_array<Config::Lighting::MAX_CSM_SPLITS_PER_LIGHT>(true));
60 PROPERTY_RW(bool, showDirectionCone, false);
63
64 void lockDirection(const bool state) noexcept;
65
66protected:
67 void OnData(const ECS::CustomEvent& data) override;
68
69protected:
70 //Used to adjust ortho-matrix's near/far planes per pass
72END_COMPONENT(DirectionalLight);
73
74} // namespace Divide
75
76#endif //DVD_DIRECTIONAL_LIGHT_COMPONENT_H_
#define PROPERTY_RW(...)
Convenience method to add a class member with public read access and write access.
#define PROPERTY_R(...)
Convenience method to add a class member with public read access but protected write access.
#define BEGIN_COMPONENT_EXT1(Name, Enum, Base1)
Definition: SGNComponent.h:219
#define END_COMPONENT(Name)
Definition: SGNComponent.h:223
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
void OnData(const ECS::CustomEvent &data) override
uint8_t U8
void lockDirection(const bool state) noexcept
DirectionalLightComponent(SceneGraphNode *sgn, PlatformContext &context)
eastl::vector< Type > vector
Definition: Vector.h:42
vector< FeedBackContainer > _feedbackContainers
vector< FeedBackContainer > & feedBackContainers() noexcept
void setDirection(const vec3< F32 > &direction)