67 #ifndef _graphicsproceduralmarblegenerator_cpp
68 #define _graphicsproceduralmarblegenerator_cpp
70 #include "Graphics/Procedural/Texture/marblegenerator.h"
72 #include "Noise/Module/perlin.h"
74 #include "MathTools/mathtools.h"
83 GenColour(1.0,1.0,1.0,1.0),
96 MathTools::MersenneTwisterGenerator32 NumGen(this->
GenSeed);
97 Whole RandNum = NumGen.GenerateUInt();
98 Noise::Module::Perlin Noise;
99 Noise.SetFrequency(1.0 / 32.0);
100 Noise.SetLacunarity(1.5);
101 Noise.SetOctaveCount(2);
102 Noise.SetPersistence(0.15);
103 Real XFact = ( 1.0 / 96.0 );
104 Real YFact = ( 1.0 / 48.0 );
110 Real NoiseVal = std::min(
Real(1.0), MathTools::Abs( MathTools::Sin( X * XFact + Y * YFact + this->
GenTurbulence * Noise.GetValue( X + RandNum, Y + RandNum, 0 ) ) * MathTools::GetPi() ) );
120 {
return "MarbleGenerator"; }
virtual void AddToTextureBuffer(TextureBuffer &Buffer) const
Replaces and populates the pixels as configured in this generator to a TextureBuffer.
virtual ~MarbleGenerator()
Class destructor.
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...
MarbleGenerator & SetTurbulence(const Real Turb)
Sets the turbulence that will modify the generated pattern.
MarbleGenerator()
Class constructor.
Whole GetWidth() const
Get the pixel width of this texture.
MarbleGenerator & SetColour(const ColourValue &Colour)
Sets the colour of the marble structure.
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...
Real GenTurbulence
The amount of disruption to apply to the pattern.
ColourValue GenColour
The colour to be applied to the marble structure.
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.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Creates a marble structured image.
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...
Whole GenSeed
The seed to be used for the random number generator.
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.
MarbleGenerator & SetSeed(const Whole Seed)
Sets the seed for the "random" number generator.
virtual String GetName() const
Gets the name of this generator.