ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
SpiralMaterial.h
Go to the documentation of this file.
1/**
2 * @file SpiralMaterial.h
3 * @brief A material class for generating spiral effects.
4 *
5 * This class provides functionality for creating spiraling patterns
6 * using customizable colors, width, and bending parameters.
7 *
8 * @date 22/12/2024
9 * @author Coela Can't
10 */
11
12#pragma once
13
14#include "../Material.h"
15#include "../../../Utils/Math/Mathematics.h"
16#include "../../../Utils/Math/Vector2D.h"
17#include "../../../Utils/Math/Rotation.h"
18
19/**
20 * @class SpiralMaterial
21 * @brief Generates a spiral pattern with configurable properties.
22 *
23 * This class provides methods for manipulating the position, rotation,
24 * width, and bend of a spiral. The pattern is created using an array
25 * of RGB colors.
26 */
27class SpiralMaterial : public Material {
28private:
29 RGBColor* rgbColors; ///< Array of colors for the spiral.
30 RGBColor* baseRGBColors; ///< Backup array for the original colors.
31 uint8_t colorCount; ///< Number of colors in the spiral.
32 Vector2D positionOffset; ///< Offset for the position of the spiral.
33 Vector2D rotationOffset; ///< Point around which the spiral rotates.
34 float width; ///< Width of the spiral arms.
35 float bend; ///< Degree of bending for the spiral arms.
36 float rotationAngle; ///< Angle to rotate the spiral pattern.
37
38public:
39 /**
40 * @brief Constructs a SpiralMaterial instance.
41 *
42 * @param colorCount Number of colors in the spiral.
43 * @param rgbColors Pointer to an array of colors.
44 * @param width Width of the spiral arms.
45 * @param bend Degree of bending for the spiral arms.
46 */
47 SpiralMaterial(uint8_t colorCount, RGBColor* rgbColors, float width, float bend);
48
49 /**
50 * @brief Destructor for SpiralMaterial.
51 */
53
54 /**
55 * @brief Sets the position offset for the spiral.
56 *
57 * @param positionOffset The offset to apply.
58 */
60
61 /**
62 * @brief Sets the rotation offset for the spiral.
63 *
64 * @param rotationOffset The point around which to rotate.
65 */
67
68 /**
69 * @brief Sets the rotation angle for the spiral.
70 *
71 * @param rotationAngle The angle to rotate the spiral pattern.
72 */
74
75 /**
76 * @brief Sets the width of the spiral arms.
77 *
78 * @param width The desired width.
79 */
80 void SetWidth(float width);
81
82 /**
83 * @brief Sets the bending factor of the spiral arms.
84 *
85 * @param bend The degree of bending.
86 */
87 void SetBend(float bend);
88
89 /**
90 * @brief Shifts the hue of the spiral colors.
91 *
92 * @param hueDeg The degree to shift the hue.
93 */
94 void HueShift(float hueDeg);
95
96 /**
97 * @brief Retrieves the color for a given position.
98 *
99 * @param position 3D position in the scene.
100 * @param normal Normal vector at the position (not used for this material).
101 * @param uvw Texture coordinates at the position (not used for this material).
102 * @return The RGB color corresponding to the given position.
103 */
104 RGBColor GetRGB(const Vector3D& position, const Vector3D& normal, const Vector3D& uvw) override;
105};
Abstract base class for rendering materials.
Definition Material.h:27
Represents an RGB color and provides methods for manipulation.
Definition RGBColor.h:23
Generates a spiral pattern with configurable properties.
void SetPositionOffset(Vector2D positionOffset)
Sets the position offset for the spiral.
void SetRotationAngle(float rotationAngle)
Sets the rotation angle for the spiral.
RGBColor * rgbColors
Array of colors for the spiral.
Vector2D positionOffset
Offset for the position of the spiral.
void HueShift(float hueDeg)
Shifts the hue of the spiral colors.
void SetBend(float bend)
Sets the bending factor of the spiral arms.
uint8_t colorCount
Number of colors in the spiral.
float rotationAngle
Angle to rotate the spiral pattern.
RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
Retrieves the color for a given position.
void SetRotationOffset(Vector2D rotationOffset)
Sets the rotation offset for the spiral.
RGBColor * baseRGBColors
Backup array for the original colors.
void SetWidth(float width)
Sets the width of the spiral arms.
Vector2D rotationOffset
Point around which the spiral rotates.
~SpiralMaterial()
Destructor for SpiralMaterial.
float width
Width of the spiral arms.
float bend
Degree of bending for the spiral arms.
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Definition Vector2D.h:27
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26