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

A modifier that will attempt to combine the content of multiple textures. More...

#include <combinemodifier.h>

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

Public Types

typedef std::vector< CombineLayerCombineLayerContainer
 Basic container type for CombineLayer storage by this class.
 
typedef CombineLayerContainer::iterator CombineLayerIterator
 Iterator type for CombineLayer instances stored by this class.
 
enum  CombineMode {
  CM_Add_Clamp = 1, CM_Add_Wrap = 2, CM_Sub_Clamp = 3, CM_Sub_Wrap = 4,
  CM_Multiply = 5, CM_Multiply_Double = 6, CM_Blend = 7, CM_Alpha = 8,
  CM_Layer = 9
}
 An enum used to describe how a texture is to be combined with the other textures in the queue. More...
 
typedef CombineLayerContainer::const_iterator ConstCombineLayerIterator
 Const Iterator type for CombineLayer instances stored by this class.
 

Public Member Functions

 CombineModifier ()
 Blank constructor.
 
virtual ~CombineModifier ()
 Class destructor.
 
CombineModifierAddTexture (TextureBuffer *Layer, const CombineMode Mode)
 Adds a texture to the end of the sequence to be processed. More...
 
virtual String GetName () const
 Gets the name of this modifier. More...
 
virtual void Modify (TextureBuffer &Buffer)
 Alters the generated pixels in a TextureBuffer. More...
 
CombineModifierRemoveAllTextures ()
 Removes all textures from all layers. More...
 
CombineModifierSetFilterColour (const ColourValue &Colour)
 Sets which colour channels to filter (and by how much) from each layer texture. More...
 
CombineModifierSetFilterColour (const Real Red, const Real Green, const Real Blue, const Real Alpha)
 Sets which colour channels to filter (and by how much) from each layer texture. More...
 
- Public Member Functions inherited from Mezzanine::Graphics::Procedural::TextureModifier
 TextureModifier ()
 Blank constructor.
 
virtual ~TextureModifier ()
 Class destructor.
 

Protected Member Functions

void ProcessLayer (const CombineLayer &Layer, TextureBuffer &Buffer)
 Processes a single layer to combine it with the target image. More...
 

Protected Attributes

ColourValue CombineFilterColour
 The amount of colour from each layer that is to be used when combining textures. More...
 
CombineLayerContainer CombineLayers
 A container of all the layers to be applied to the target texture in sequence. More...
 

Detailed Description

A modifier that will attempt to combine the content of multiple textures.

To use this modifier, textures should be added in sequence based on the order in which you want to apply the textures to the target texture. Added textures are not combined directly, rather the first texture is applied to the target texture and the second texture is applied to the result of that operation and so forth, from the first texture specified to the last.

Definition at line 96 of file combinemodifier.h.

Member Enumeration Documentation

An enum used to describe how a texture is to be combined with the other textures in the queue.

Unless explicitly stated, modes in this enum do not operate on the Alpha Channel.

Enumerator
CM_Add_Clamp 

Simple addition of colours. This will generally make the result image brighter. Overflowing colour channels will be clamped to the maximum value.

CM_Add_Wrap 

Simple addition of colours. This can make the image brighter or darker, because overflowing colour channels will wrap back to 0 and increment from there.

CM_Sub_Clamp 

Simple subtraction of colours. This will generally make the result image darker. Underflowing colour channels will be clamped to the minimum value.

CM_Sub_Wrap 

Simple subtraction of colours. This can make the image brighter or darker, because underflowing colour channels will wrap back to the maximum value and decrement from there.

CM_Multiply 

Multiplication of colours. Results are then divided by 256. This can make the image brighter or darker. Overflowing colour channels will be clamped to the maximum value.

CM_Multiply_Double 

Multiplication of colours. Results are then divided by 128, causing the result to be double what you would get with CM_Multiply. This will generally make the result image brighter than CM_Multiply, but can also make it darker with low colour values. Overflowing colour channels will be clamped to the maximum value.

CM_Blend 

For each colour channel, add them together and divide by two. Produces the average of both textures.

CM_Alpha 

As CM_Blend, but only performs the operation on the Alpha channel. Leaves other channels unmodified.

CM_Layer 

Uses the Alpha Channel from the current operating texture to fade the colours in the target texture. The inverse of the Alpha Channel is applied to the colours of the current operating texture. The results are then added together.

Definition at line 101 of file combinemodifier.h.

Member Function Documentation

CombineModifier & Mezzanine::Graphics::Procedural::CombineModifier::AddTexture ( TextureBuffer Layer,
const CombineMode  Mode 
)

Adds a texture to the end of the sequence to be processed.

Parameters
LayerA pointer to the texture being added.
ModeThe combine operation to be performed between the specified texture in the first argument and the target texture being processed by the modifier.
Returns
Returns a reference to this.

Definition at line 269 of file combinemodifier.cpp.

String Mezzanine::Graphics::Procedural::CombineModifier::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 263 of file combinemodifier.cpp.

void Mezzanine::Graphics::Procedural::CombineModifier::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 254 of file combinemodifier.cpp.

void Mezzanine::Graphics::Procedural::CombineModifier::ProcessLayer ( const CombineLayer Layer,
TextureBuffer Buffer 
)
protected

Processes a single layer to combine it with the target image.

Parameters
LayerThe texture being combined with the result image.
BufferThe buffer being drawn to/combined with.

Definition at line 85 of file combinemodifier.cpp.

CombineModifier & Mezzanine::Graphics::Procedural::CombineModifier::RemoveAllTextures ( )

Removes all textures from all layers.

Returns
Returns a reference to this.

Definition at line 280 of file combinemodifier.cpp.

CombineModifier & Mezzanine::Graphics::Procedural::CombineModifier::SetFilterColour ( const ColourValue Colour)

Sets which colour channels to filter (and by how much) from each layer texture.

Parameters
ColourThe amount of colour from the layer texture to keep when combining. Initial Value: (1.0,1.0,1.0,1.0).
Returns
Returns a reference to this.

Definition at line 286 of file combinemodifier.cpp.

CombineModifier & Mezzanine::Graphics::Procedural::CombineModifier::SetFilterColour ( const Real  Red,
const Real  Green,
const Real  Blue,
const Real  Alpha 
)

Sets which colour channels to filter (and by how much) from each layer texture.

Parameters
RedThe amount of red colour from the layer texture to keep when combining. Initial Value: 1.0.
GreenThe amount of green colour from the layer texture to keep when combining. Initial Value: 1.0.
BlueThe amount of blue colour from the layer texture to keep when combining. Initial Value: 1.0.
AlphaThe amount of alpha colour from the layer texture to keep when combining. Initial Value: 1.0.
Returns
Returns a reference to this.

Definition at line 292 of file combinemodifier.cpp.

Member Data Documentation

ColourValue Mezzanine::Graphics::Procedural::CombineModifier::CombineFilterColour
protected

The amount of colour from each layer that is to be used when combining textures.

Definition at line 125 of file combinemodifier.h.

CombineLayerContainer Mezzanine::Graphics::Procedural::CombineModifier::CombineLayers
protected

A container of all the layers to be applied to the target texture in sequence.

Definition at line 128 of file combinemodifier.h.


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