Specular Lighting filter. More...
#include <ilviews/bitmaps/filters/lighting.h>
Public Member Functions | |
IlvSpecularLightingFilter (IlFloat surfaceScale=1.0, IlFloat specularConstant=1.0, IlFloat specularExponent=1.0, IlvLightSource *light=0) | |
Constructor. More... | |
~IlvSpecularLightingFilter () | |
Destructor. More... | |
IlvBitmapData * | apply (IlUInt count=0, const IlvBitmapData **inputs=0) |
IlFloat | getSpecularConstant () const |
Returns the specular constant. More... | |
IlFloat | getSpecularExponent () const |
Returns the specular exponent. More... | |
void | setSpecularConstant (IlFloat specularConstant) |
Sets the specular constant value. More... | |
void | setSpecularExponent (IlFloat specularExponent) |
Sets the specular exponent value. More... | |
Public Member Functions inherited from IlvLightingFilter | |
IlvLightingFilter (IlFloat surfaceScale=1.0, IlvLightSource *light=0) | |
Constructor. More... | |
virtual | ~IlvLightingFilter () |
Destructor. More... | |
IlFloat * | computeBumpMap (const IlvRGBBitmapData *src, IlFloat scaleX, IlFloat scaleY) |
Computes the bump map for the given image. More... | |
IlvLightSource * | getLightSource () const |
Returns the light source. More... | |
IlFloat | getSurfaceScale () const |
Returns the surface scale. More... | |
void | setLightSource (IlvLightSource *light) |
void | setSurfaceScale (IlFloat scale) |
Sets the surface scale. More... | |
Public Member Functions inherited from IlvBitmapFilter | |
IlvBitmapFilter () | |
Constructor. More... | |
virtual | ~IlvBitmapFilter () |
Destructor. More... | |
IlvBitmapData * | applyUnary (const IlvBitmapData *data) |
Convenience method for unary filters. More... | |
virtual const char * | getClassName () const |
Returns the class name of the filter. More... | |
IlUInt | getHeight () const |
Returns the height of the filter effect region. More... | |
const char *const * | getInputs (IlUInt &count) const |
Returns the name of the input bitmap data. More... | |
const char * | getName () const |
Returns the name of the filter. More... | |
IlUInt | getRefCount () const |
Returns the reference count for this instance. | |
const char * | getResult () const |
Returns the name of the result bitmap data. More... | |
IlUInt | getWidth () const |
Returns the width of the filter effect region. More... | |
IlInt | getX () const |
Returns the left coordinate of the filter effect region. More... | |
IlInt | getY () const |
Returns the top coordinate of the filter effect region. More... | |
void | lock () |
Locks the current instance. | |
void | setHeight (IlUInt height) |
Sets the height of the filter effect region. More... | |
void | setInputs (IlUInt count, const char *const *name) |
Sets the input names of the filter. More... | |
void | setName (const char *id) |
Sets the name of the filter. More... | |
void | setResult (const char *name) |
Sets the result name of the filter. More... | |
void | setWidth (IlUInt width) |
Sets the width of the filter effect region. More... | |
void | setX (IlInt x) |
Sets the left coordinate of the filter effect region. More... | |
void | setY (IlInt y) |
Sets the top coordinate of the filter effect region. More... | |
void | unLock () |
Unlocks the current instance. When the reference count is 0 , the instance is deleted. | |
Public Member Functions inherited from IlvValueInterface | |
virtual IlBoolean | applyValue (const IlvValue &value) |
Apply an accessor. More... | |
virtual IlBoolean | changeValue (const IlvValue &val) |
Changes the value of an accessor. More... | |
virtual IlBoolean | changeValues (const IlvValue *values, IlUShort count=0) |
Changes several accessor values simultaneously. More... | |
virtual void | getAccessors (const IlSymbol *const **names, const IlvValueTypeClass *const **types, IlUInt &count) const |
Retrieves the list of available accessors of an object. More... | |
virtual IlvValue & | queryValue (IlvValue &val) const |
Retrieves an accessor value. More... | |
virtual void | queryValues (IlvValue *values, IlUShort count) const |
Retrieves multiple accessor values simultaneously. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from IlvBitmapFilter | |
static IlvBitmapFilter * | Create (const char *classname, IlBoolean forceLoad=IlTrue) |
This static method creates an instance of a bitmap filter of given classname. If the filter class is not registered and forceLoad is IlTrue , an attempt to load a dynamic module for this filter is made. More... | |
static const char ** | GetRegisteredFilters (IlUInt &num) |
This static method returns an array of registered filter class names. More... | |
Specular Lighting filter.
Library: ilvbmpflt
This class allows you to light an image using a specular lighting model. The alpha channel of the source image is used as the bump map.
The resulting image is computed as follows: Sr = ks * pow(N.H, specularExponent) * Lr Sg = ks * pow(N.H, specularExponent) * Lg
Sb = ks * pow(N.H, specularExponent) * Lb Sa = Max(Sr, Sg, Sb) where ks = specular lighting constant. N = surface normal unit vector, a function of x and y. H = unit vector pointing from surface to light, a function of x and y in the point and spot light cases. Lr, Lg, Lb = RGB components of the light, a function of x and y in the spot light case. N is a function of x and y and depends on the surface gradient as follows: The surface described by the input alpha image A(x, y) is: Z(x, y) = surfaceScale * Ain(x, y)
See IlvDiffuseLightingFilter
for a definition of N. Unlike IlvDiffuseLightingFilter
, IlvSpecularLightingFilter
produces a non-opaque image.
IlvSpecularLightingFilter::IlvSpecularLightingFilter | ( | IlFloat | surfaceScale = 1.0 , |
IlFloat | specularConstant = 1.0 , |
||
IlFloat | specularExponent = 1.0 , |
||
IlvLightSource * | light = 0 |
||
) |
Constructor.
Initializes a new instance of the class IlvSpecularLightingFilter
.
The default surface scale is 1.0
. The default specular constant is 1.0
. The default specular exponent is 1.0
.
IlvSpecularLightingFilter::~IlvSpecularLightingFilter | ( | ) |
Destructor.
The destructor releases all the memory used by the instance.
|
virtual |
Applies the specular lighting to the given image.
Reimplemented from IlvBitmapFilter.
IlFloat IlvSpecularLightingFilter::getSpecularConstant | ( | ) | const |
Returns the specular constant.
IlFloat IlvSpecularLightingFilter::getSpecularExponent | ( | ) | const |
Returns the specular exponent.
void IlvSpecularLightingFilter::setSpecularConstant | ( | IlFloat | specularConstant | ) |
Sets the specular constant value.
specularConstant | The new specular constant. |
void IlvSpecularLightingFilter::setSpecularExponent | ( | IlFloat | specularExponent | ) |
Sets the specular exponent value.
specularExponent | The new specular exponent. |