Ogre Procedural  0.3.0 unstable
Procedural Geometry & Textures for Ogre3D
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Procedural::Convolution Class Reference

Convolution filter. More...

#include <ProceduralTextureModifiers.h>

Inheritance diagram for Procedural::Convolution:
Inheritance graph
[legend]

Public Member Functions

 Convolution (TextureBufferPtr pBuffer)
 Default constructor. More...
 
 ~Convolution ()
 Default destructor to release memory. More...
 
ConvolutionsetKernel (Ogre::uchar size, Ogre::Real *data)
 Set a new kernel. More...
 
ConvolutionsetKernel (Ogre::uchar size, int *data)
 Set a new kernel. More...
 
ConvolutionsetKernel (Ogre::Matrix3 data)
 Set a new kernel. More...
 
ConvolutionsetDivisor (Ogre::Real divisor)
 Set a devisor. More...
 
ConvolutioncalculateDivisor ()
 Calculate a new devisor from given kernel. More...
 
ConvolutionsetThreshold (Ogre::uchar threshold)
 Set threshold value. More...
 
ConvolutionsetCalculateEdgeDivisor (bool calculateedgedivisor)
 Switch dynamic divisor for edges on or off. More...
 
ConvolutionsetIncludeAlphaChannel (bool usealpha)
 Switch on/off the use of the alpha channel. More...
 
TextureBufferPtr process ()
 Run image manipulation. More...
 
Ogre::String getName ()
 Get name of the filter as string. More...
 
void setLog (bool enable=true)
 Enable/Disable logging. More...
 

Protected Member Functions

void logMsg (Ogre::String msg)
 

Protected Attributes

TextureBufferPtr mBuffer
 
Ogre::String mName
 
bool mLog
 

Detailed Description

Convolution filter.

The filter calculates each pixel of the result image as weighted sum of the correspond pixel and its neighbors.

Example:

Procedural::TextureBuffer bufferImage(256);
Procedural::Image(&bufferImage).setFile("red_brick.jpg").process();
Ogre::Matrix3(10.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, -10.0f)
).process();

dot_texture_09.png

Note
All kernels must be square matrices and larger than 2x2 (min. 3x3)!

Constructor & Destructor Documentation

◆ Convolution()

Procedural::Convolution::Convolution ( TextureBufferPtr  pBuffer)

Default constructor.

Parameters
pBufferImage buffer where to modify the image.

◆ ~Convolution()

Procedural::Convolution::~Convolution ( )

Default destructor to release memory.

Member Function Documentation

◆ calculateDivisor()

Convolution& Procedural::Convolution::calculateDivisor ( )

Calculate a new devisor from given kernel.

Remarks
setKernel calls calculateDivisor after changeing the kernel memory!

◆ getName()

Ogre::String Procedural::TextureProcessing::getName ( )
inherited

Get name of the filter as string.

◆ logMsg()

void Procedural::TextureProcessing::logMsg ( Ogre::String  msg)
protectedinherited

◆ process()

TextureBufferPtr Procedural::Convolution::process ( )
virtual

Run image manipulation.

Returns
Pointer to image buffer which has been set in the constructor.

Implements Procedural::TextureProcessing.

◆ setCalculateEdgeDivisor()

Convolution& Procedural::Convolution::setCalculateEdgeDivisor ( bool  calculateedgedivisor)

Switch dynamic divisor for edges on or off.

Parameters
calculateedgedivisorSet true to use dynamic divisor for edges (default true)

◆ setDivisor()

Convolution& Procedural::Convolution::setDivisor ( Ogre::Real  divisor)

Set a devisor.

Parameters
divisorSet specific devisor (default 1.0)
Remarks
setKernel calls calculateDivisor after changeing the kernel memory! If you like to set a user defined devisor call setDivisor always after setKernel!

◆ setIncludeAlphaChannel()

Convolution& Procedural::Convolution::setIncludeAlphaChannel ( bool  usealpha)

Switch on/off the use of the alpha channel.

Parameters
usealphaSet true to also modify the alpha channel (default false)

◆ setKernel() [1/3]

Convolution& Procedural::Convolution::setKernel ( Ogre::Matrix3  data)

Set a new kernel.

Parameters
dataMatrix with data for new kernel
Remarks
setKernel calls calculateDivisor after changeing the kernel memory! If you like to set a user defined devisor call setDivisor always after setKernel!

◆ setKernel() [2/3]

Convolution& Procedural::Convolution::setKernel ( Ogre::uchar  size,
int *  data 
)

Set a new kernel.

Parameters
sizeNumber of lines/rows of the quadratic kernel
dataArray with data for new kernel by rows
Remarks
setKernel calls calculateDivisor after changeing the kernel memory! If you like to set a user defined devisor call setDivisor always after setKernel!

◆ setKernel() [3/3]

Convolution& Procedural::Convolution::setKernel ( Ogre::uchar  size,
Ogre::Real data 
)

Set a new kernel.

Parameters
sizeNumber of lines/rows of the quadratic kernel (default 3)
dataArray with data for new kernel by rows
Remarks
setKernel calls calculateDivisor after changeing the kernel memory! If you like to set a user defined devisor call setDivisor always after setKernel!

◆ setLog()

void Procedural::TextureProcessing::setLog ( bool  enable = true)
inherited

Enable/Disable logging.

Parameters
enabletrue enables logging of filter actions

◆ setThreshold()

Convolution& Procedural::Convolution::setThreshold ( Ogre::uchar  threshold)

Set threshold value.

Parameters
thresholdNew threshold value [0, 255] (default 128)

Member Data Documentation

◆ mBuffer

TextureBufferPtr Procedural::TextureProcessing::mBuffer
protectedinherited

◆ mLog

bool Procedural::TextureProcessing::mLog
protectedinherited

◆ mName

Ogre::String Procedural::TextureProcessing::mName
protectedinherited

The documentation for this class was generated from the following file:
Procedural::Image::process
TextureBufferPtr process()
Run image generation.
Procedural::Image
Load an image from a resource.
Definition: ProceduralTextureGenerator.h:334
Procedural::Convolution
Convolution filter.
Definition: ProceduralTextureModifiers.h:848
Procedural::Convolution::process
TextureBufferPtr process()
Run image manipulation.
Procedural::Convolution::setKernel
Convolution & setKernel(Ogre::uchar size, Ogre::Real *data)
Set a new kernel.
Procedural::TextureBuffer
class to store image data while processing
Definition: ProceduralTextureBuffer.h:50
Procedural::Image::setFile
Image & setFile(Ogre::String filename, Ogre::String groupname=Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME)
Set the colour of the background.
Ogre::Matrix3