ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
SimpleMaterial.h
Go to the documentation of this file.
1/**
2 * @file SimpleMaterial.h
3 * @brief A material class that applies a single RGB color to all surfaces.
4 *
5 * The `SimpleMaterial` class is designed for cases where a uniform color is required for rendering,
6 * with optional hue-shifting functionality for dynamic color effects.
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" // Utility for 2D vector operations.
16
17/**
18 * @class SimpleMaterial
19 * @brief A material that applies a single, solid RGB color to surfaces.
20 *
21 * This class allows setting a static RGB color or dynamically adjusting its hue for visual effects.
22 */
23class SimpleMaterial : public Material {
24private:
25 RGBColor rgb; ///< The active RGB color applied to the surface.
26 RGBColor baseRGB; ///< The base RGB color used for reference during hue shifts.
27
28public:
29 /**
30 * @brief Constructs a `SimpleMaterial` with a specified RGB color.
31 *
32 * @param rgb The initial color to be applied to the material.
33 */
35
36 /**
37 * @brief Adjusts the hue of the material's color.
38 *
39 * This function shifts the hue of the current color by the specified degree value
40 * while maintaining its brightness and saturation.
41 *
42 * @param hueDeg The hue shift in degrees (range: 0–360).
43 */
44 void HueShift(float hueDeg);
45
46 /**
47 * @brief Sets a new RGB color for the material.
48 *
49 * @param rgb The new RGB color to apply.
50 */
51 void SetRGB(RGBColor rgb);
52
53 /**
54 * @brief Retrieves the RGB color for a surface.
55 *
56 * For `SimpleMaterial`, this always returns the same color, regardless of position, normal, or texture coordinates.
57 *
58 * @param position 3D position in the scene (not used for this material).
59 * @param normal Normal vector at the position (not used for this material).
60 * @param uvw Texture coordinates at the position (not used for this material).
61 * @return The RGB color of the material.
62 */
63 RGBColor GetRGB(const Vector3D& position, const Vector3D& normal, const Vector3D& uvw) override;
64};
Abstract base class for rendering materials.
Definition Material.h:27
Represents an RGB color and provides methods for manipulation.
Definition RGBColor.h:23
A material that applies a single, solid RGB color to surfaces.
RGBColor baseRGB
The base RGB color used for reference during hue shifts.
void SetRGB(RGBColor rgb)
Sets a new RGB color for the material.
void HueShift(float hueDeg)
Adjusts the hue of the material's color.
RGBColor rgb
The active RGB color applied to the surface.
RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
Retrieves the RGB color for a surface.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26