67 #ifndef _graphicsproceduralflaremodifier_cpp
68 #define _graphicsproceduralflaremodifier_cpp
70 #include "Graphics/Procedural/Texture/flaremodifier.h"
72 #include "MathTools/mathtools.h"
81 FlareColour(1.0,1.0,1.0,1.0),
104 Real InverseRadiusX = 1.0 /
static_cast<Real>( RadiusX );
105 Real InverseRadiusY = 1.0 /
static_cast<Real>( RadiusY );
107 for(
Integer Y = 0 ; Y < TargetHeight ; ++Y )
109 Real DeltaY =
static_cast<Real>( Y - CenterY ) * InverseRadiusY;
111 for(
Integer X = 0 ; X < TargetWidth ; ++X )
113 Real DeltaX =
static_cast<Real>( X - CenterX ) * InverseRadiusX;
114 Real Distance = MathTools::Sqrt(DeltaX * DeltaX + DeltaY * DeltaY);
115 if( Distance >= 1.0 ) {
118 Distance = 1.0 - Distance;
126 Buffer.
SetPixelByte(X,Y, static_cast<UInt8>( (Red < 255) ? Red : 255 ),static_cast<UInt8>( (Green < 255) ? Green : 255 ),static_cast<UInt8>( (Blue < 255) ? Blue : 255 ),Alpha);
132 {
return "FlareModifier"; }
void SetPixelByte(const Whole X, const Whole Y, const ColourChannelType Red, const ColourChannelType Green, const ColourChannelType Blue, const ColourChannelType Alpha=255)
Set colour of a specified pixel using a 0-255 range. the X or Y location go beyond the set size of th...
FlareModifier & SetFlareCenterX(const Real X)
Sets the center position of the flare on the X axis.
Whole GetWidth() const
Get the pixel width of this texture.
ColourChannelType GetBlueByte(const Whole X, const Whole Y) const
Gets the blue colour value of a specified pixel. the X or Y location go beyond the set size of this t...
int Integer
A datatype used to represent any integer close to.
FlareModifier & SetColour(const ColourValue &Colour)
Sets the colour of the flare to be rendered.
uint8_t UInt8
An 8-bit unsigned integer.
FlareModifier & SetFlareCenter(const Vector2 &Center)
Sets the center position of the flare.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
ColourChannelType GetAlphaByte(const Whole X, const Whole Y) const
Gets the alpha colour value of a specified pixel. the X or Y location go beyond the set size of this ...
float Real
A Datatype used to represent a real floating point number.
FlareModifier()
Blank constructor.
A modifier that will draw an illuminated circle that fades over a distance to a previous texture...
Real GreenChannel
Value from 0.0 to 1.0 representing the amount of green present in the colour. 1.0 if very green...
Real Y
Coordinate on the Y vector.
FlareModifier & SetFlareBrightness(const Real Brightness)
Sets the brightness of the flare.
Real X
Coordinate on the X vector.
This is used to represent a point on a 2 dimentional area, such as a screen.
FlareModifier & SetFlareRadiusX(const Real X)
Sets the radius size of the flare on the X axis.
virtual void Modify(TextureBuffer &Buffer)
Alters the generated pixels in a TextureBuffer.
FlareModifier & SetFlareCenterY(const Real Y)
Sets the center position of the flare on the Y axis.
void SetValues(const Real Red, const Real Green, const Real Blue, const Real Alpha)
Sets each of the colour channels.
virtual ~FlareModifier()
Class destructor.
A convenience buffer that stores pixel colour values of a texture to be generated.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Whole GetHeight() const
Get the pixel height of this texture.
Real BlueChannel
Value from 0.0 to 1.0 representing the amount of blue present in the colour. 1.0 if very blue...
FlareModifier & SetFlareRadiusY(const Real Y)
Sets the radius size of the flare on the Y axis.
FlareModifier & SetFlareRadius(const Vector2 &Radius)
Sets the radius size of the flare.
Vector2 FlareCenter
The central position of the flare on the texture in relative coordinates.
Real RedChannel
Value from 0.0 to 1.0 representing the amount of red present in the colour. 1.0 if very red...
ColourChannelType GetGreenByte(const Whole X, const Whole Y) const
Gets the green colour value of a specified pixel. the X or Y location go beyond the set size of this ...
Real FlareBrightness
A modifier for the intensity of the flare colour.
std::string String
A datatype used to a series of characters.
Vector2 FlareRadius
The radius of the flare to draw in relative coordinates.
virtual String GetName() const
Gets the name of this modifier.
ColourChannelType GetRedByte(const Whole X, const Whole Y) const
Gets the red colour value of a specified pixel. the X or Y location go beyond the set size of this te...
ColourValue FlareColour
The colour of the flare to draw.