Rogue Wave Views 5.5.1 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Diffuse Lighting filter. More...
#include <ilviews/bitmaps/filters/lighting.h>
Public Member Functions | |
IlvDiffuseLightingFilter (IlFloat surfaceScale=1.0, IlFloat diffuseConstant=1.0, IlvLightSource *light=0) | |
Constructor. | |
~IlvDiffuseLightingFilter () | |
Destructor. | |
IlvBitmapData * | apply (IlUInt count=0, const IlvBitmapData **inputs=0) |
IlFloat | getDiffuseConstant () const |
Returns the diffuse constant. | |
void | setDiffuseConstant (IlFloat diffuse) |
Sets the diffuse constant value. |
Diffuse Lighting filter.
Library: ilvbmpflt
This class allows you to light an image using a diffuse lighting model. The resulting image is an opaque image based on the light color. The alpha channel of the source image is used as the bump map.
The resulting image is computed as follows: Dr = kd * N.L * Lr Dg = kd * N.L * Lg Db = kd * N.L * Lb Da = 1.0 where kd = diffuse lighting constant. N = surface normal unit vector, a function of x and y. L = 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)
Surface normal is calculated using the Sobel gradient 3x3 filter: Nx(x, y) = - surfaceScale * 0.25 * ((I(x+1, y-1) + 2 * I(x+1, y) + I(x+1,y))
IlvRGBBitmapData
, IlvBitmapFilter
, IlvLightingFilter
, IlvSpecularLightingFilter
, IlvLightSource
, IlvDistantLight
, IlvPointLight
, IlvSpotLight
IlvDiffuseLightingFilter::IlvDiffuseLightingFilter | ( | IlFloat | surfaceScale = 1.0 , |
|
IlFloat | diffuseConstant = 1.0 , |
|||
IlvLightSource * | light = 0 | |||
) |
Constructor.
Initializes a new instance of the class IlvDiffuseLightingFilter
.
The default surface scale is 1.0
. The default diffuse constant is 1.0
.
IlvDiffuseLightingFilter::~IlvDiffuseLightingFilter | ( | ) |
Destructor.
The destructor releases all the memory used by the instance.
IlvBitmapData* IlvDiffuseLightingFilter::apply | ( | IlUInt | count = 0 , |
|
const IlvBitmapData ** | inputs = 0 | |||
) | [virtual] |
Applies the diffuse lighting to the given image.
Reimplemented from IlvBitmapFilter.
IlFloat IlvDiffuseLightingFilter::getDiffuseConstant | ( | ) | const |
Returns the diffuse constant.
void IlvDiffuseLightingFilter::setDiffuseConstant | ( | IlFloat | diffuse | ) |
Sets the diffuse constant value.
diffuse | The new diffuse constant. |
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.