ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
LightMaterial.h
Go to the documentation of this file.
1/**
2 * @file LightMaterial.h
3 * @brief A material class that incorporates multiple light sources for advanced lighting effects.
4 *
5 * The `LightMaterial` class provides an interface for managing a set of light sources
6 * and calculating the resulting illumination for a given material.
7 *
8 * @date 22/12/2024
9 * @author Coela Can't
10 */
11
12#pragma once
13
14#include "../Material.h" // Base class for materials.
15#include "../../../Utils/Math/Vector2D.h" // Vector utilities.
16#include "../../../Renderer/Lights/Light.h" // Light source definitions.
17
18/**
19 * @class LightMaterial
20 * @brief A material class that incorporates multiple light sources for rendering.
21 *
22 * This template-based material class allows for dynamic lighting by utilizing a fixed number
23 * of light sources. The lighting calculations take into account position, normal, and texture
24 * coordinates to determine the final color output.
25 *
26 * @tparam lightCount The number of lights included in the material.
27 */
28template<size_t lightCount>
29class LightMaterial : public Material {
30private:
31 Light lights[lightCount]; ///< Array of lights used for lighting calculations.
32
33public:
34 /**
35 * @brief Constructs a `LightMaterial` object with the specified number of lights.
36 */
38
39 /**
40 * @brief Retrieves the array of lights.
41 *
42 * @return Pointer to the array of `Light` objects.
43 */
45
46 /**
47 * @brief Retrieves the number of lights in the material.
48 *
49 * @return The number of lights (`lightCount`).
50 */
51 uint8_t GetLightCount();
52
53 /**
54 * @brief Calculates the RGB color at a specific position using the light sources.
55 *
56 * @param position 3D position in the scene.
57 * @param normal Normal vector at the position.
58 * @param uvw Texture coordinates at the position.
59 * @return The calculated RGB color.
60 */
61 RGBColor GetRGB(const Vector3D& position, const Vector3D& normal, const Vector3D& uvw) override;
62};
63
64#include "LightMaterial.tpp" // Include the template implementation.
A material class that incorporates multiple light sources for rendering.
LightMaterial()
Constructs a LightMaterial object with the specified number of lights.
Light * GetLights()
Retrieves the array of lights.
Light lights[lightCount]
Array of lights used for lighting calculations.
RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
Calculates the RGB color at a specific position using the light sources.
uint8_t GetLightCount()
Retrieves the number of lights in the material.
Represents a light source with position, intensity, and falloff properties.
Definition Light.h:22
Abstract base class for rendering materials.
Definition Material.h:27
Represents an RGB color and provides methods for manipulation.
Definition RGBColor.h:23
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26