![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Implements a fisheye distortion effect for pixel groups. More...
#include <Fisheye.h>
Public Member Functions | |
Fisheye (float amplitude=0.5f) | |
Constructs a Fisheye effect with a specified amplitude. | |
void | SetPosition (Vector2D offset) |
Sets the distortion center offset. | |
void | SetAmplitude (float amplitude) |
Sets the amplitude of the distortion. | |
void | ApplyEffect (IPixelGroup *pixelGroup) override |
Applies the fisheye effect to the given pixel group. | |
![]() | |
Effect () | |
Default constructor for the Effect class. | |
void | SetRatio (float ratio) |
Sets the scaling ratio for the effect. | |
Private Attributes | |
Vector2D | offset = Vector2D(0.0f, 0.0f) |
Offset for the fisheye distortion center. | |
float | amplitude |
Amplitude of the distortion effect. | |
FunctionGenerator | fGenSize = FunctionGenerator(FunctionGenerator::Sine, 1.0f, 48.0f, 2.3f) |
Controls the size modulation. | |
FunctionGenerator | fGenX = FunctionGenerator(FunctionGenerator::Sine, -96.0f, 96.0f, 2.7f) |
Controls X-axis displacement. | |
FunctionGenerator | fGenY = FunctionGenerator(FunctionGenerator::Sine, -96.0f, 96.0f, 1.7f) |
Controls Y-axis displacement. | |
FunctionGenerator | fGenWarp = FunctionGenerator(FunctionGenerator::Sine, 1.0f, 100.0f, 3.7f) |
Controls warp effect. | |
Additional Inherited Members | |
![]() | |
float | ratio = 0.0f |
A scaling ratio used for dynamic effect adjustments. | |
Implements a fisheye distortion effect for pixel groups.
The Fisheye
effect dynamically distorts pixel positions around a specified offset using sinusoidal function generators for smooth, animated transformations.
Constructs a Fisheye
effect with a specified amplitude.
amplitude | The amplitude of the fisheye distortion. Default is 0.5. |
Definition at line 3 of file Fisheye.cpp.
|
overridevirtual |
Applies the fisheye effect to the given pixel group.
This method modifies the positions of the pixels in the group based on the fisheye distortion formula, using the amplitude, offset, and function generators.
pixelGroup | Pointer to the IPixelGroup to which the effect will be applied. |
Implements Effect.
Definition at line 13 of file Fisheye.cpp.
References amplitude, RGBColor::B, Vector2D::CalculateEuclideanDistance(), fGenWarp, fGenX, fGenY, RGBColor::G, IPixelGroup::GetCenterCoordinate(), IPixelGroup::GetColorBuffer(), IPixelGroup::GetColors(), IPixelGroup::GetCoordinate(), IPixelGroup::GetOffsetXYIndex(), IPixelGroup::GetPixelCount(), offset, RGBColor::R, Effect::ratio, FunctionGenerator::Update(), Vector2D::X, and Vector2D::Y.
Sets the amplitude of the distortion.
amplitude | The new amplitude for the fisheye effect. |
Definition at line 9 of file Fisheye.cpp.
References amplitude.
Sets the distortion center offset.
offset | The new offset for the fisheye effect center. |
Definition at line 5 of file Fisheye.cpp.
References offset.
|
private |
Amplitude of the distortion effect.
Definition at line 29 of file Fisheye.h.
Referenced by ApplyEffect(), and SetAmplitude().
|
private |
|
private |
|
private |
|
private |
Offset for the fisheye distortion center.
Definition at line 28 of file Fisheye.h.
Referenced by ApplyEffect(), and SetPosition().