![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Implements a magnetic distortion effect for pixel groups. More...
#include <Magnet.h>
Public Member Functions | |
Magnet (float amplitude=0.5f) | |
Constructs a Magnet effect with a specified amplitude. | |
void | SetPosition (Vector2D offset) |
Sets the central position of the magnetic effect. | |
void | SetAmplitude (float amplitude) |
Sets the amplitude of the magnetic distortion effect. | |
void | ApplyEffect (IPixelGroup *pixelGroup) override |
Applies the magnetic distortion 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) |
The central offset of the magnetic effect. | |
float | amplitude |
The strength of the magnetic distortion. | |
FunctionGenerator | fGenSize = FunctionGenerator(FunctionGenerator::Sine, 1.0f, 5000.0f, 2.3f) |
Generator for field size dynamics. | |
FunctionGenerator | fGenX = FunctionGenerator(FunctionGenerator::Sine, -96.0f, 96.0f, 2.7f) |
Generator for X-axis warp dynamics. | |
FunctionGenerator | fGenY = FunctionGenerator(FunctionGenerator::Sine, -96.0f, 96.0f, 1.7f) |
Generator for Y-axis warp dynamics. | |
FunctionGenerator | fGenWarp = FunctionGenerator(FunctionGenerator::Sine, 1.0f, 100.0f, 3.7f) |
Generator for warp intensity dynamics. | |
Additional Inherited Members | |
![]() | |
float | ratio = 0.0f |
A scaling ratio used for dynamic effect adjustments. | |
Implements a magnetic distortion effect for pixel groups.
The Magnet
effect distorts pixel positions by applying a simulated magnetic field, creating dynamic and fluid distortion patterns.
Constructs a Magnet
effect with a specified amplitude.
amplitude | The initial strength of the magnetic distortion. Default is 0.5f. |
Definition at line 3 of file Magnet.cpp.
|
overridevirtual |
Applies the magnetic distortion effect to the given pixel group.
This method modifies pixel positions dynamically based on the magnetic field simulation.
pixelGroup | Pointer to the IPixelGroup to which the effect will be applied. |
Implements Effect.
Definition at line 13 of file Magnet.cpp.
References amplitude, RGBColor::B, Vector2D::CalculateEuclideanDistance(), RGBColor::G, IPixelGroup::GetCenterCoordinate(), IPixelGroup::GetColorBuffer(), IPixelGroup::GetColors(), IPixelGroup::GetCoordinate(), IPixelGroup::GetOffsetXYIndex(), IPixelGroup::GetPixelCount(), offset, RGBColor::R, Vector2D::X, and Vector2D::Y.
Sets the amplitude of the magnetic distortion effect.
amplitude | The new amplitude value. |
Definition at line 9 of file Magnet.cpp.
References amplitude.
Sets the central position of the magnetic effect.
offset | The Vector2D position to set as the central offset. |
Definition at line 5 of file Magnet.cpp.
References offset.
Referenced by XenraxAnimation::Update().
|
private |
The strength of the magnetic distortion.
Definition at line 28 of file Magnet.h.
Referenced by ApplyEffect(), and SetAmplitude().
|
private |
|
private |
|
private |
|
private |
The central offset of the magnetic effect.
Definition at line 27 of file Magnet.h.
Referenced by ApplyEffect(), and SetPosition().