Avara3D 0.2.0
C++ API reference
SpotLight.h
1//
2// SpotLight.h
3// avara3d
4//
5// Created by Morgan Davis on 7/31/2024.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_VISUAL_LIGHT_SPOTLIGHT_H
10#define AVARA3D_VISUAL_LIGHT_SPOTLIGHT_H
11
12#include <cstdint>
13#include <string>
14
15#include "a3d/Color.h"
16#include "a3d/visual/light/Attenuation.h"
17#include "a3d/visual/light/Light.h"
18
19namespace a3d {
20
28 class SpotLight : public Light {
29
30 public:
31 // [Public Types]
32
34 enum class FeatheringMode : uint8_t {
35 Linear = 0,
36 Sharp = 1,
37 Soft = 2
38 };
39
40 // [Public Lifecycle Functions]
41
44
46 explicit SpotLight(const std::string& name);
47
49 explicit SpotLight(const Color& color);
50
52 SpotLight(const std::string& name, const Color& color);
53
54 SpotLight(const SpotLight&) = default;
55 SpotLight& operator=(const SpotLight&) = default;
56
57 SpotLight(SpotLight&&) noexcept = default;
58 SpotLight& operator=(SpotLight&&) noexcept = default;
59
60 public:
61 // [Public Member Functions]
62
64 float innerAngle() const;
65
67 void innerAngle(float angle);
68
70 float outerAngle() const;
71
73 void outerAngle(float angle);
74
77
80
82 const Attenuation& attenuation() const;
83
86
87 // [Internal Member Functions]
88
89 float innerAngleCos() const;
90 float outerAngleCos() const;
91
92 private:
93 // [Private Member Variables]
94
95 float _innerAngleCos;
96 float _outerAngleCos;
97 FeatheringMode _featherMode;
98 Attenuation _attenuation;
99 };
100
101}
102
103#endif // AVARA3D_VISUAL_LIGHT_SPOTLIGHT_H
Represents a normalized RGBA color.
Definition: Color.h:27
Base class for light sources attached to Scene Nodes.
Definition: Light.h:32
const std::optional< std::string > & name() const
Returns the optional light name.
const Color & color() const
Returns the light color.
Cone-shaped light located and oriented by its containing Node.
Definition: SpotLight.h:28
SpotLight(const std::string &name, const Color &color)
Creates a SpotLight with name and color.
FeatheringMode featheringMode() const
Returns the angular feathering curve.
float outerAngle() const
Returns the outer cone half-angle in radians.
const Attenuation & attenuation() const
Returns the distance-attenuation coefficients.
SpotLight(const Color &color)
Creates an unnamed SpotLight with color.
FeatheringMode
Selects the intensity curve between the outer and inner cone angles.
Definition: SpotLight.h:34
SpotLight(const std::string &name)
Creates a named white SpotLight.
float innerAngle() const
Returns the inner cone half-angle in radians.
SpotLight()
Creates an unnamed white SpotLight.
Distance-attenuation coefficients for point and spot lights.
Definition: Attenuation.h:20