ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
RainbowSpiral.h
Go to the documentation of this file.
1/**
2 * @file RainbowSpiral.h
3 * @brief A dynamic material that creates a colorful, animated rainbow spiral effect.
4 *
5 * This file defines the RainbowSpiral class, which combines a spiral material with
6 * a rainbow color spectrum and an animated function for dynamic visual effects.
7 *
8 * @date 22/12/2024
9 * @author Coela Can't
10 */
11
12#pragma once
13
14#include "../AnimatedMaterial.h" // Base class for animated materials.
15#include "../../../Utils/Signals/FunctionGenerator.h" // Utility for generating animated functions.
16#include "../Static/SpiralMaterial.h" // Include for the spiral material implementation.
17
18/**
19 * @class RainbowSpiral
20 * @brief A dynamic material creating a colorful rainbow spiral animation.
21 *
22 * The RainbowSpiral class generates a visually dynamic effect by combining a spiral
23 * material with a rainbow gradient and function-driven animation.
24 */
26private:
27 FunctionGenerator fGenMatBend = FunctionGenerator(FunctionGenerator::Sine, 0.8f, 0.9f, 6.7f); ///< Function generator for animating spiral bending.
28 RGBColor rainbowSpectrum[6] = {RGBColor(255, 0, 0), RGBColor(255, 255, 0), RGBColor(0, 255, 0), RGBColor(0, 255, 255), RGBColor(0, 0, 255), RGBColor(255, 0, 255)}; ///< Predefined rainbow color spectrum.
29 SpiralMaterial spiralMaterial = SpiralMaterial(6, rainbowSpectrum, 3.0f, 7.0f); ///< Spiral material configured with rainbow spectrum and scale parameters.
30
31public:
32 /**
33 * @brief Default constructor for RainbowSpiral.
34 */
36
37 /**
38 * @brief Updates the material animation based on the time ratio.
39 *
40 * @param ratio The time ratio used for animation updates.
41 */
42 void Update(float ratio);
43
44 /**
45 * @brief Retrieves the associated spiral material.
46 *
47 * @return Pointer to the SpiralMaterial instance.
48 */
50
51 /**
52 * @brief Computes the color at a given position in the material.
53 *
54 * @param position The position in 3D space.
55 * @param normal The surface normal vector.
56 * @param uvw The texture coordinates.
57 * @return The computed color as an RGBColor.
58 */
59 RGBColor GetRGB(const Vector3D& position, const Vector3D& normal, const Vector3D& uvw) override;
60};
Base class for dynamically updating materials.
A class to generate various waveform functions with customizable parameters.
@ Sine
Sine waveform.
Abstract base class for rendering materials.
Definition Material.h:27
Represents an RGB color and provides methods for manipulation.
Definition RGBColor.h:23
A dynamic material creating a colorful rainbow spiral animation.
RainbowSpiral()
Default constructor for RainbowSpiral.
RGBColor rainbowSpectrum[6]
Predefined rainbow color spectrum.
Material * GetMaterial()
Retrieves the associated spiral material.
RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
Computes the color at a given position in the material.
SpiralMaterial spiralMaterial
Spiral material configured with rainbow spectrum and scale parameters.
FunctionGenerator fGenMatBend
Function generator for animating spiral bending.
void Update(float ratio)
Updates the material animation based on the time ratio.
Generates a spiral pattern with configurable properties.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26