Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | Protected Attributes | List of all members
Mezzanine::Graphics::Procedural::CrackModifier Class Reference

A modifier that will generate random coloured lines on a texture. More...

#include <crackmodifier.h>

+ Inheritance diagram for Mezzanine::Graphics::Procedural::CrackModifier:
+ Collaboration diagram for Mezzanine::Graphics::Procedural::CrackModifier:

Public Types

enum  LengthMode { LM_Constant = 1, LM_Random = 2, LM_NormalBased = 3 }
 An enum used to set how the length of each generated crack is to be determined. More...
 
enum  QualityMode { QM_LowQuality = 1, QM_Blend = 2, QM_SubPixel = 3 }
 An enum used to set the quality. More...
 

Public Member Functions

 CrackModifier ()
 Blank constructor.
 
virtual ~CrackModifier ()
 Class destructor.
 
virtual String GetName () const
 Gets the name of this modifier. More...
 
virtual void Modify (TextureBuffer &Buffer)
 Alters the generated pixels in a TextureBuffer. More...
 
CrackModifierSetColour (const ColourValue &Colour)
 Sets the colour of the generated cracks. More...
 
CrackModifierSetColour (const Real Red, const Real Green, const Real Blue, const Real Alpha=1.0)
 Sets the colour of the generated cracks. More...
 
CrackModifierSetCrackCount (const Whole Count)
 Sets how many cracks to create. More...
 
CrackModifierSetCrackLength (const UInt8 Length)
 Sets the length of each crack that is created. May not be used verbatim. More...
 
CrackModifierSetCrackLengthMode (const LengthMode Length)
 Sets any additional configuration for the length of the cracks. More...
 
CrackModifierSetCrackQualityMode (const QualityMode Quality)
 Sets any additional configuration for the colour/sampling of the crack colour. More...
 
CrackModifierSetCrackVariation (const UInt8 Variation)
 Sets the amount of wobble or stutter to the cracks that are created. More...
 
CrackModifierSetGeneratorSeed (const Whole Seed)
 Sets the seed for the random number generator used to determine crack starting positions. More...
 
CrackModifierSetNormalsTexture (TextureBuffer *Normals)
 Sets the normals texture to use for generating cracks. More...
 
- Public Member Functions inherited from Mezzanine::Graphics::Procedural::TextureModifier
 TextureModifier ()
 Blank constructor.
 
virtual ~TextureModifier ()
 Class destructor.
 

Protected Attributes

ColourValue CrackColour
 The base colour to give to the pixels forming the cracks. More...
 
Whole CrackCount
 The number of cracks to generate. More...
 
UInt8 CrackLength
 The pixel length of the cracks to be generated. More...
 
LengthMode CrackLengthMode
 The mode in which the final length of each crack is determined. See LengthMode enum for more details. More...
 
QualityMode CrackQualityMode
 The mode in which the colours at or near the crack are to be determined. See QualityMode enum for more details. More...
 
UInt8 CrackVariation
 Determines the amount of "stutter" to the cracks normal curve (or non-curve depending on the parameter image). More...
 
Whole GeneratorSeed
 The seed for the random number generator used to place the cracks. More...
 
TextureBufferNormalsTexture
 The parameter image to pull normals the cracks are to move along from. Alpha channel and colours may also be used. More...
 

Detailed Description

A modifier that will generate random coloured lines on a texture.

Crack starting points are generated randomly, and can be configured to have varying or non-varying lengths. Cracks will bend based on normals generated from the parameter image. Normals are calculated from the red and green channels exclusively. Values on the Blue channel have no effect.

Additionally the Alpha channel in the parameter image can be used to filter which pixels are allowed to generate lines. This is done internally by comparing the Alpha channel value to the normal length.

Definition at line 86 of file crackmodifier.h.

Member Enumeration Documentation

An enum used to set how the length of each generated crack is to be determined.

Enumerator
LM_Constant 

The modifier will use the configured length unaltered.

LM_Random 

The modifier will randomize the pixel length of the cracks between zero and double the configured length.

LM_NormalBased 

The modifier will generate the pixel length of a crack between the configured value and a value larger based on the normal length set in the parameter texture.

Definition at line 90 of file crackmodifier.h.

An enum used to set the quality.

Enumerator
QM_LowQuality 

Use the configured colour for cracks without further modification.

QM_Blend 

Combines the colours from the image being modified and the configured crack colour.

QM_SubPixel 

Attempts to blend the colours of all surrounding pixels for a more smooth appearance.

Definition at line 97 of file crackmodifier.h.

Member Function Documentation

String Mezzanine::Graphics::Procedural::CrackModifier::GetName ( ) const
virtual

Gets the name of this modifier.

Returns
Returns a string containing the name of this modifier.

Implements Mezzanine::Graphics::Procedural::TextureModifier.

Definition at line 217 of file crackmodifier.cpp.

void Mezzanine::Graphics::Procedural::CrackModifier::Modify ( TextureBuffer Buffer)
virtual

Alters the generated pixels in a TextureBuffer.

Parameters
BufferThe buffer to be modified.

Implements Mezzanine::Graphics::Procedural::TextureModifier.

Definition at line 97 of file crackmodifier.cpp.

CrackModifier & Mezzanine::Graphics::Procedural::CrackModifier::SetColour ( const ColourValue Colour)

Sets the colour of the generated cracks.

Parameters
ColourThe base colour to give to the pixels forming the cracks. Initial Value: (1.0,1.0,1.0,1.0).
Returns
Returns a reference to this.

Definition at line 229 of file crackmodifier.cpp.

CrackModifier & Mezzanine::Graphics::Procedural::CrackModifier::SetColour ( const Real  Red,
const Real  Green,
const Real  Blue,
const Real  Alpha = 1.0 
)

Sets the colour of the generated cracks.

Parameters
RedThe amount of red to give to the pixels forming the cracks. Initial Value: 1.0.
GreenThe amount of green to give to the pixels forming the cracks. Initial Value: 1.0.
BlueThe amount of blue to give to the pixels forming the cracks. Initial Value: 1.0.
AlphaThe amount of alpha to give to the pixels forming the cracks. Initial Value: 1.0.
Returns
Returns a reference to this.

Definition at line 235 of file crackmodifier.cpp.

CrackModifier & Mezzanine::Graphics::Procedural::CrackModifier::SetCrackCount ( const Whole  Count)

Sets how many cracks to create.

Parameters
CountThe number of cracks to generate. Initial Value: 100.
Returns
Returns a reference to this.

Definition at line 241 of file crackmodifier.cpp.

CrackModifier & Mezzanine::Graphics::Procedural::CrackModifier::SetCrackLength ( const UInt8  Length)

Sets the length of each crack that is created. May not be used verbatim.

Parameters
LengthThe pixel length of the cracks to be generated. Initial Value: 255.
Returns
Returns a reference to this.

Definition at line 259 of file crackmodifier.cpp.

CrackModifier & Mezzanine::Graphics::Procedural::CrackModifier::SetCrackLengthMode ( const LengthMode  Length)

Sets any additional configuration for the length of the cracks.

Parameters
LengthThe mode in which the final length of each crack is determined. See LengthMode enum for more details. Initial Value: LM_Constant.
Returns
Returns a reference to this.

Definition at line 247 of file crackmodifier.cpp.

CrackModifier & Mezzanine::Graphics::Procedural::CrackModifier::SetCrackQualityMode ( const QualityMode  Quality)

Sets any additional configuration for the colour/sampling of the crack colour.

Parameters
QualityThe mode in which the colours at or near the crack are to be determined. See QualityMode enum for more details. Initial Value: QM_LowQuality.
Returns
Returns a reference to this.

Definition at line 253 of file crackmodifier.cpp.

CrackModifier & Mezzanine::Graphics::Procedural::CrackModifier::SetCrackVariation ( const UInt8  Variation)

Sets the amount of wobble or stutter to the cracks that are created.

Parameters
VariationDetermines the amount of "stutter" to the cracks normal curve (or non-curve depending on the parameter image). Initial Value: 64.
Returns
Returns a reference to this.

Definition at line 265 of file crackmodifier.cpp.

CrackModifier & Mezzanine::Graphics::Procedural::CrackModifier::SetGeneratorSeed ( const Whole  Seed)

Sets the seed for the random number generator used to determine crack starting positions.

Parameters
SeedThe seed to be used for the randomly generatated positions to place the cracks. Initial Value: 5120.
Returns
Returns a reference to this.

Definition at line 271 of file crackmodifier.cpp.

CrackModifier & Mezzanine::Graphics::Procedural::CrackModifier::SetNormalsTexture ( TextureBuffer Normals)

Sets the normals texture to use for generating cracks.

Parameters
NormalsA pointer to the Texture to use for reading normals that cracks will be generated along. Initial Value: NULL.
Returns
Returns a reference to this.

Definition at line 223 of file crackmodifier.cpp.

Member Data Documentation

ColourValue Mezzanine::Graphics::Procedural::CrackModifier::CrackColour
protected

The base colour to give to the pixels forming the cracks.

Definition at line 106 of file crackmodifier.h.

Whole Mezzanine::Graphics::Procedural::CrackModifier::CrackCount
protected

The number of cracks to generate.

Definition at line 112 of file crackmodifier.h.

UInt8 Mezzanine::Graphics::Procedural::CrackModifier::CrackLength
protected

The pixel length of the cracks to be generated.

Definition at line 124 of file crackmodifier.h.

LengthMode Mezzanine::Graphics::Procedural::CrackModifier::CrackLengthMode
protected

The mode in which the final length of each crack is determined. See LengthMode enum for more details.

Definition at line 118 of file crackmodifier.h.

QualityMode Mezzanine::Graphics::Procedural::CrackModifier::CrackQualityMode
protected

The mode in which the colours at or near the crack are to be determined. See QualityMode enum for more details.

Definition at line 121 of file crackmodifier.h.

UInt8 Mezzanine::Graphics::Procedural::CrackModifier::CrackVariation
protected

Determines the amount of "stutter" to the cracks normal curve (or non-curve depending on the parameter image).

Definition at line 127 of file crackmodifier.h.

Whole Mezzanine::Graphics::Procedural::CrackModifier::GeneratorSeed
protected

The seed for the random number generator used to place the cracks.

Definition at line 115 of file crackmodifier.h.

TextureBuffer* Mezzanine::Graphics::Procedural::CrackModifier::NormalsTexture
protected

The parameter image to pull normals the cracks are to move along from. Alpha channel and colours may also be used.

Definition at line 109 of file crackmodifier.h.


The documentation for this class was generated from the following files: