67 #ifndef _graphicsproceduraljittermodifier_cpp
68 #define _graphicsproceduraljittermodifier_cpp
70 #include "Graphics/Procedural/Texture/jittermodifier.h"
72 #include "MathTools/randomnumber.h"
94 MathTools::MersenneTwisterGenerator32 NumGen(this->
GeneratorSeed);
99 for(
Integer Y = 0; Y < TargetHeight ; ++Y )
101 for(
Integer X = 0; X < TargetWidth ; ++X )
103 Integer NewX = X + ( NumGen.GenerateUInt() % ( Radius * 2 + 1 ) ) - Radius;
104 Integer NewY = Y + ( NumGen.GenerateUInt() % ( Radius * 2 + 1 ) ) - Radius;
106 if( NewX >= 0 && NewX < TargetWidth && NewY >= 0 && NewY < TargetHeight ) {
107 TempBuffer.
SetPixel(static_cast<Whole>(NewX),static_cast<Whole>(NewY), Buffer.
GetPixel(static_cast<Whole>(X),static_cast<Whole>(Y)) );
115 {
return "JitterModifier"; }
ColourChannelType & GetPixel(const Whole X, const Whole Y, const UInt16 Component)
Gets access to the pixel at the specified position in this buffer. the X or Y location go beyond the ...
Whole GetWidth() const
Get the pixel width of this texture.
int Integer
A datatype used to represent any integer close to.
JitterModifier & SetJitterRadius(const UInt16 Radius)
Sets the range in which pixels can be swapped.
virtual void Modify(TextureBuffer &Buffer)
Alters the generated pixels in a TextureBuffer.
virtual ~JitterModifier()
Class destructor.
uint16_t UInt16
An 16-bit unsigned integer.
Whole GeneratorSeed
The seed to be used for the random number generator.
JitterModifier & SetGeneratorSeed(const Whole Seed)
Sets the seed for the "random" number generator.
A modifier that will randomly shuffle the pixel being processed to a nearby position.
A convenience buffer that stores pixel colour values of a texture to be generated.
virtual String GetName() const
Gets the name of this modifier.
JitterModifier()
Blank constructor.
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.
void SetPixel(const Whole X, const Whole Y, const ColourValue &Colour)
Set colour of a specified pixel using a ColourValue. the X or Y location go beyond the set size of th...
UInt16 JitterRadius
The radius around the pixel being processed in which the pixel can be displaced.
std::string String
A datatype used to a series of characters.
void SetData(const TextureBuffer &Other)
Copies image data from another buffer into this buffer.