ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
StripeMaterial.h
Go to the documentation of this file.
1/**
2 * @file StripeMaterial.h
3 * @brief A material class for generating striped patterns with configurable properties.
4 *
5 * This class provides functionality for creating dynamic striped patterns with wave effects,
6 * color gradients, and rotational transformations.
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 StripeMaterial
21 * @brief Generates striped patterns with configurable properties.
22 *
23 * The `StripeMaterial` class provides methods for creating and manipulating
24 * striped patterns that can include wave effects, color gradients, and rotational
25 * transformations.
26 */
27class StripeMaterial : public Material {
28private:
29 RGBColor* rgbColors; ///< Array of colors used for the stripes.
30 RGBColor* baseRGBColors; ///< Backup of the original colors for hue adjustments.
31 uint8_t colorCount; ///< Number of colors in the stripe pattern.
32 Vector2D positionOffset; ///< Offset for the stripe position.
33 Vector2D rotationOffset; ///< Rotation center for the pattern.
34 float stripeWidth; ///< Width of each stripe in the pattern.
35 float wavePeriod; ///< Period of the sinusoidal wave effect.
36 float waveAmplitude; ///< Amplitude of the sinusoidal wave effect.
37 float rotationAngle; ///< Angle for rotating the pattern.
38
39public:
40 /**
41 * @brief Constructs a StripeMaterial with given properties.
42 *
43 * @param colorCount Number of colors in the stripe pattern.
44 * @param rgbColors Array of RGB colors for the stripes.
45 * @param stripeWidth Width of each stripe.
46 * @param wavePeriod Period of the wave effect.
47 * @param waveAmplitude Amplitude of the wave effect.
48 */
50
51 /**
52 * @brief Sets the position offset for the pattern.
53 *
54 * @param positionOffset The desired position offset.
55 */
57
58 /**
59 * @brief Sets the rotation offset (center point) for the pattern.
60 *
61 * @param rotationOffset The center point for rotation.
62 */
64
65 /**
66 * @brief Sets the rotation angle for the pattern.
67 *
68 * @param rotationAngle The desired rotation angle in degrees.
69 */
71
72 /**
73 * @brief Sets the stripe width.
74 *
75 * @param stripeWidth The desired stripe width.
76 */
78
79 /**
80 * @brief Sets the wave period for the sinusoidal effect.
81 *
82 * @param wavePeriod The desired wave period.
83 */
85
86 /**
87 * @brief Sets the wave amplitude for the sinusoidal effect.
88 *
89 * @param waveAmplitude The desired wave amplitude.
90 */
92
93 /**
94 * @brief Applies a hue shift to the stripe colors.
95 *
96 * @param hueDeg The degree of hue shift to apply.
97 */
98 void HueShift(float hueDeg);
99
100 /**
101 * @brief Computes the color at a given position.
102 *
103 * @param position 3D position in the scene.
104 * @param normal Normal vector at the position (not used for this material).
105 * @param uvw Texture coordinates at the position (not used for this material).
106 * @return The RGB color corresponding to the given position.
107 */
108 RGBColor GetRGB(const Vector3D& position, const Vector3D& normal, const Vector3D& uvw) override;
109};
Abstract base class for rendering materials.
Definition Material.h:27
Represents an RGB color and provides methods for manipulation.
Definition RGBColor.h:23
Generates striped patterns with configurable properties.
void SetStripeWidth(float stripeWidth)
Sets the stripe width.
void SetPositionOffset(Vector2D positionOffset)
Sets the position offset for the pattern.
void SetRotationAngle(float rotationAngle)
Sets the rotation angle for the pattern.
float waveAmplitude
Amplitude of the sinusoidal wave effect.
RGBColor * rgbColors
Array of colors used for the stripes.
Vector2D positionOffset
Offset for the stripe position.
void SetWaveAmplitude(float waveAmplitude)
Sets the wave amplitude for the sinusoidal effect.
void HueShift(float hueDeg)
Applies a hue shift to the stripe colors.
uint8_t colorCount
Number of colors in the stripe pattern.
float rotationAngle
Angle for rotating the pattern.
RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
Computes the color at a given position.
void SetRotationOffset(Vector2D rotationOffset)
Sets the rotation offset (center point) for the pattern.
RGBColor * baseRGBColors
Backup of the original colors for hue adjustments.
float wavePeriod
Period of the sinusoidal wave effect.
void SetWavePeriod(float wavePeriod)
Sets the wave period for the sinusoidal effect.
StripeMaterial(uint8_t colorCount, RGBColor *rgbColors, float stripeWidth, float wavePeriod, float waveAmplitude)
Constructs a StripeMaterial with given properties.
Vector2D rotationOffset
Rotation center for the pattern.
float stripeWidth
Width of each stripe in the pattern.
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