ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
RainbowNoise2.cpp
Go to the documentation of this file.
1#include "RainbowNoise2.h"
2
3void RainbowNoise2::Update(float ratio) {
4 float sweep = fGenMatGradient.Update();
5 float sShift = sweep * 0.004f + 0.005f;
6
7 simplexNoiseDepth += 0.01f;
8
9 gNoiseMat.SetGradientPeriod(0.5f + sweep * 12.0f);
10 gNoiseMat.HueShift(ratio * 360 * 2);
11 sNoise.SetScale(Vector3D(sShift, sShift, sShift));
13}
14
18
19RGBColor RainbowNoise2::GetRGB(const Vector3D& position, const Vector3D& normal, const Vector3D& uvw) {
20 return sNoise.GetRGB(position, normal, uvw);
21}
A dynamic material generating a rainbow effect using simplex noise with a black-to-color gradient.
float Update()
Updates and calculates the next value of the waveform.
void HueShift(float hueDeg)
Shifts the hue of the gradient by a specified degree.
void SetGradientPeriod(float gradientPeriod)
Sets the gradient's period of repetition.
Abstract base class for rendering materials.
Definition Material.h:27
Represents an RGB color and provides methods for manipulation.
Definition RGBColor.h:23
GradientMaterial< 4 > gNoiseMat
Gradient material for simplex noise.
Material * GetMaterial()
Retrieves the associated material.
float simplexNoiseDepth
Depth parameter for simplex noise.
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.
void SetScale(Vector3D noiseScale)
Sets the scale for noise generation.
void SetZPosition(float zPosition)
Sets the Z-position for 3D noise generation.
RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
Retrieves the color for a given position based on the noise value.
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26