ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
RainbowNoise2.h
Go to the documentation of this file.
1/**
2 * @file RainbowNoise2.h
3 * @brief A dynamic material generating a rainbow effect using simplex noise with a black-to-color gradient.
4 *
5 * This file defines the RainbowNoise2 class, which uses simplex noise combined
6 * with a gradient material to create a dynamic, flowing rainbow effect transitioning from black to color.
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/GradientMaterial.h" // Include for gradient materials.
17#include "../Static/SimplexNoise.h" // Include for simplex noise generation.
18
19/**
20 * @class RainbowNoise2
21 * @brief A dynamic material that creates a rainbow effect using simplex noise with black-to-color transitions.
22 *
23 * The RainbowNoise2 class combines simplex noise with a gradient material to
24 * produce a dynamic, colorful effect that shifts over time, starting from black.
25 */
27private:
28 FunctionGenerator fGenMatGradient = FunctionGenerator(FunctionGenerator::Sine, 0.0f, 0.5f, 6.65f); ///< Function to animate gradient properties.
29 RGBColor noiseSpectrum[4] = {RGBColor(0, 0, 0), RGBColor(255, 0, 0), RGBColor(0, 255, 0), RGBColor(0, 0, 255)}; ///< Spectrum for the gradient, starting with black.
30 GradientMaterial<4> gNoiseMat = GradientMaterial<4>(noiseSpectrum, 2.0f, false); ///< Gradient material for simplex noise.
31 SimplexNoise<4> sNoise = SimplexNoise<4>(1, &gNoiseMat); ///< Simplex noise generator.
32 float simplexNoiseDepth = 0.0f; ///< Depth parameter for simplex noise.
33
34public:
35 /**
36 * @brief Default constructor for RainbowNoise2.
37 */
39
40 /**
41 * @brief Updates the material animation based on the time ratio.
42 *
43 * @param ratio The time ratio used for animation updates.
44 */
45 void Update(float ratio);
46
47 /**
48 * @brief Retrieves the associated material.
49 *
50 * @return Pointer to the GradientMaterial instance.
51 */
53
54 /**
55 * @brief Computes the color at a given position in the material.
56 *
57 * @param position The position in 3D space.
58 * @param normal The surface normal vector.
59 * @param uvw The texture coordinates.
60 * @return The computed color as an RGBColor.
61 */
62 RGBColor GetRGB(const Vector3D& position, const Vector3D& normal, const Vector3D& uvw) override;
63};
Base class for dynamically updating materials.
A class to generate various waveform functions with customizable parameters.
@ Sine
Sine waveform.
Creates a customizable gradient material for rendering.
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 that creates a rainbow effect using simplex noise with black-to-color transitions.
RainbowNoise2()
Default constructor for RainbowNoise2.
GradientMaterial< 4 > gNoiseMat
Gradient material for simplex noise.
Material * GetMaterial()
Retrieves the associated material.
float simplexNoiseDepth
Depth parameter for simplex noise.
RGBColor noiseSpectrum[4]
Spectrum for the gradient, starting with black.
RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
Computes the color at a given position in the material.
void Update(float ratio)
Updates the material animation based on the time ratio.
FunctionGenerator fGenMatGradient
Function to animate gradient properties.
SimplexNoise< 4 > sNoise
Simplex noise generator.
A material class for rendering Simplex Noise.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26