ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
TVStatic.cpp
Go to the documentation of this file.
1#include "TVStatic.h"
2
3void TVStatic::Update(float ratio) {
4 simplexNoiseDepth += 0.1f;
5
7 gNoiseMat.HueShift(ratio * 360 * 2);
8 sNoise.SetScale(Vector3D(0.5f, 0.5f, 0.5f));
10
11 scanlineGradient.GradientShift(fmodf(ratio * 5.0f, 1.0f));
12
13 colorTest.SetHueAngle(360.0f * ratio);
14 colorTest.SetPosition(Vector2D(96.0f + colorWiggle1.Update(), Mathematics::Map(ratio, 0.0f, 1.0f, -100.0f, 100.0f) + colorWiggle2.Update()));
15}
16
20
21RGBColor TVStatic::GetRGB(const Vector3D& position, const Vector3D& normal, const Vector3D& uvw) {
22 return combineScanline.GetRGB(position, normal, uvw);
23}
A dynamic material for simulating TV static with various noise effects.
RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
Calculates the resulting color by combining all materials.
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 GradientShift(float ratio)
Shifts the gradient by a ratio.
void SetGradientPeriod(float gradientPeriod)
Sets the gradient's period of repetition.
Abstract base class for rendering materials.
Definition Material.h:27
static T Map(T value, T inLow, T inMax, T outMin, T outMax)
Maps a value from one range to another.
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.
CombineMaterial< 3 > combineScanline
Material combiner for layering effects.
Definition TVStatic.h:65
GradientMaterial< 10 > scanlineGradient
Scanline gradient material.
Definition TVStatic.h:62
SimplexNoise< 5 > sNoise
Simplex noise generator for TV static.
Definition TVStatic.h:45
Material * GetMaterial()
Retrieves the combined material representing the TV static effect.
Definition TVStatic.cpp:17
float simplexNoiseDepth
Depth value for simplex noise animation.
Definition TVStatic.h:47
RGBColor GetRGB(const Vector3D &position, const Vector3D &normal, const Vector3D &uvw) override
Computes the color at a given position in the material.
Definition TVStatic.cpp:21
FunctionGenerator colorWiggle1
Function for animating color wiggles.
Definition TVStatic.h:32
FunctionGenerator colorWiggle2
Secondary function for color variation.
Definition TVStatic.h:33
void Update(float ratio)
Updates the animation parameters for the TV static effect.
Definition TVStatic.cpp:3
GradientMaterial< 5 > gNoiseMat
Gradient for simplex noise material.
Definition TVStatic.h:44
ColorTest colorTest
Color test overlay.
Definition TVStatic.h:64
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