67 #ifndef _graphicsproceduralcloudgenerator_cpp
68 #define _graphicsproceduralcloudgenerator_cpp
70 #include "Graphics/Procedural/Texture/cloudgenerator.h"
72 #include "MathTools/randomnumber.h"
73 #include "Noise/Module/perlin.h"
82 GenColour(1.0,1.0,1.0,1.0),
94 MathTools::MersenneTwisterGenerator32 NumGen(this->
GenSeed);
95 Whole RandNum = NumGen.GenerateUInt();
96 Noise::Module::Perlin Noise;
97 Noise.SetFrequency(1.0 / 32.0);
98 Noise.SetLacunarity(2.0);
99 Noise.SetOctaveCount(8);
100 Noise.SetPersistence(0.5);
101 Real FilterLevel = 0.7;
102 Real PreserveLevel = 0.3;
108 Real NoiseVal = std::max( 0.0, std::min( 1.0, Noise.GetValue( X + RandNum, Y + RandNum, 0 ) * 0.5 + 0.5 ) );
109 Buffer.
SetRedByte( X, Y, (
UInt8)std::min<Real>( PreserveLevel * this->
GenColour.
RedChannel * 255.0 + FilterLevel * this->GenColour.RedChannel * 255.0 * NoiseVal, 255.0 ) );
118 {
return "CloudGenerator"; }
Whole GenSeed
The seed to be used for the random number generator.
void SetRedByte(const Whole X, const Whole Y, const ColourChannelType Red)
Sets the red colour value of a specified pixel. the X or Y location go beyond the set size of this te...
ColourValue GenColour
The colour to be applied to the cloud.
Whole GetWidth() const
Get the pixel width of this texture.
CloudGenerator()
Class constructor.
CloudGenerator & SetColour(const ColourValue &Colour)
Sets the colour of the cloud.
virtual void AddToTextureBuffer(TextureBuffer &Buffer) const
Replaces and populates the pixels as configured in this generator to a TextureBuffer.
virtual String GetName() const
Gets the name of this generator.
virtual ~CloudGenerator()
Class destructor.
uint8_t UInt8
An 8-bit unsigned integer.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
CloudGenerator & SetSeed(const Whole Seed)
Sets the seed for the "random" number generator.
float Real
A Datatype used to represent a real floating point number.
void SetGreenByte(const Whole X, const Whole Y, const ColourChannelType Green)
Sets the green colour value of a specified pixel. the X or Y location go beyond the set size of this ...
Real GreenChannel
Value from 0.0 to 1.0 representing the amount of green present in the colour. 1.0 if very green...
Real AlphaChannel
Value from 0.0 to 1.0 representing the transparency of the colours. 1.0 is opaque and 0...
void SetAlphaReal(const Whole X, const Whole Y, const Real Alpha)
Sets the alpha colour value of a specified pixel. the X or Y location go beyond the set size of this ...
void SetValues(const Real Red, const Real Green, const Real Blue, const Real Alpha)
Sets each of the colour channels.
A convenience buffer that stores pixel colour values of a texture to be generated.
The bulk of the engine components go in this namspace.
Creates a cloud structured image.
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...
Real RedChannel
Value from 0.0 to 1.0 representing the amount of red present in the colour. 1.0 if very red...
void SetBlueByte(const Whole X, const Whole Y, const ColourChannelType Blue)
Sets the blue colour value of a specified pixel. the X or Y location go beyond the set size of this t...
std::string String
A datatype used to a series of characters.