Blue Brain BioExplorer
Light.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2024, EPFL/Blue Brain Project
3  * All rights reserved. Do not distribute without permission.
4  *
5  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
6  *
7  * This library is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License version 3.0 as published
9  * by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #include "Light.h"
22 
24 
25 namespace core
26 {
27 Light::Light(LightType type, const Vector3d& color, double intensity, bool isVisible)
28  : _type(type)
29  , _color(color)
30  , _intensity(intensity)
31  , _isVisible(isVisible)
32 {
33 }
34 
35 DirectionalLight::DirectionalLight(const Vector3d& direction, double angularDiameter, const Vector3d& color,
36  double intensity, bool isVisible)
37  : Light(LightType::DIRECTIONAL, color, intensity, isVisible)
38  , _direction(direction)
39  , _angularDiameter(angularDiameter)
40 {
41 }
42 
43 SphereLight::SphereLight(const Vector3d& position, double radius, const Vector3d& color, double intensity,
44  bool isVisible)
45  : Light(LightType::SPHERE, color, intensity, isVisible)
46  , _position(position)
47  , _radius(radius)
48 {
49 }
50 
51 QuadLight::QuadLight(const Vector3d& position, const Vector3d& edge1, const Vector3d& edge2, const Vector3d& color,
52  double intensity, bool isVisible)
53  : Light(LightType::QUAD, color, intensity, isVisible)
54  , _position(position)
55  , _edge1(edge1)
56  , _edge2(edge2)
57 {
58 }
59 
60 SpotLight::SpotLight(const Vector3d& position, const Vector3d& direction, const double openingAngle,
61  const double penumbraAngle, const double radius, const Vector3d& color, double intensity,
62  bool isVisible)
63  : Light(LightType::SPOTLIGHT, color, intensity, isVisible)
64  , _position(position)
65  , _direction(direction)
66  , _openingAngle(openingAngle)
67  , _penumbraAngle(penumbraAngle)
68  , _radius(radius)
69 {
70 }
71 
72 AmbientLight::AmbientLight(const Vector3d& color, double intensity, bool isVisible)
73  : Light(LightType::AMBIENT, color, intensity, isVisible)
74 {
75 }
76 
77 } // namespace core
AmbientLight()=default
The Light class defines the common base class for all lights.
Definition: Light.h:43
Light()=default
QuadLight()=default
SphereLight()=default
SpotLight()=default
glm::vec< 3, double > Vector3d
Definition: MathTypes.h:143
LightType
The LightType enum defines the different types of light.
Definition: Light.h:31