Loading [MathJax]/extensions/tex2jax.js
ProtoTracer  1.0
Real-time 3D rendering and animation engine
All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Pages
FlowNoise.cpp
Go to the documentation of this file.
1#include "FlowNoise.h"
2
3void FlowNoise::SetGradient(RGBColor color, uint8_t colorIndex) {
4 noiseSpectrum[colorIndex] = color;
6}
7
8void FlowNoise::Update(float ratio) {
9 float sweepX = fGenMatGradientX.Update();
10 float sweepY = fGenMatGradientY.Update();
11 float sweepZ = fGenMatGradientZ.Update();
12 float sShiftX = sweepX * 0.005f + 0.007f;
13 float sShiftY = sweepY * 0.005f + 0.007f;
14 float sShiftZ = sweepZ * 0.005f + 0.007f;
15
16 simplexNoiseDepth += 0.0025f;
17
19 sNoise.SetScale(Vector3D(sShiftX, sShiftY, sShiftZ));
21}
22
26
27RGBColor FlowNoise::GetRGB(const Vector3D& position, const Vector3D& normal, const Vector3D& uvw) {
28 return sNoise.GetRGB(position, normal, uvw);
29}
A dynamic simplex noise gradient material for a lava lamp effect.
FunctionGenerator fGenMatGradientX
Function for x-axis modulation.
Definition FlowNoise.h:30
FunctionGenerator fGenMatGradientZ
Function for z-axis modulation.
Definition FlowNoise.h:32
Material * GetMaterial()
Retrieves the associated material.
Definition FlowNoise.cpp:23
float simplexNoiseDepth
Depth parameter for simplex noise.
Definition FlowNoise.h:36
RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
Computes the color at a given position using simplex noise.
Definition FlowNoise.cpp:27
FunctionGenerator fGenMatGradientY
Function for y-axis modulation.
Definition FlowNoise.h:31
RGBColor noiseSpectrum[2]
Gradient colors for the noise material.
Definition FlowNoise.h:33
void SetGradient(RGBColor color, uint8_t colorIndex)
Sets a specific gradient color.
Definition FlowNoise.cpp:3
GradientMaterial< 2 > gNoiseMat
Gradient material for simplex noise.
Definition FlowNoise.h:34
void Update(float ratio)
Updates the material's state based on the provided time ratio.
Definition FlowNoise.cpp:8
SimplexNoise< 2 > sNoise
Simplex noise generator.
Definition FlowNoise.h:35
FunctionGenerator fGenMatGradientP
Function for gradient property modulation.
Definition FlowNoise.h:29
float Update()
Updates and calculates the next value of the waveform.
void UpdateGradient(RGBColor *rgbColors)
Updates the colors of the gradient.
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
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