rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvDiffuseLightingFilter Class Reference

Diffuse Lighting filter. More...

#include <ilviews/bitmaps/filters/lighting.h>

Inheritance diagram for IlvDiffuseLightingFilter:
IlvLightingFilter IlvBitmapFilter

List of all members.

Public Member Functions

 IlvDiffuseLightingFilter (IlFloat surfaceScale=1.0, IlFloat diffuseConstant=1.0, IlvLightSource *light=0)
 Constructor.
 ~IlvDiffuseLightingFilter ()
 Destructor.
IlvBitmapDataapply (IlUInt count=0, const IlvBitmapData **inputs=0)
IlFloat getDiffuseConstant () const
 Returns the diffuse constant.
void setDiffuseConstant (IlFloat diffuse)
 Sets the diffuse constant value.

Detailed Description

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))

See also:
IlvRGBBitmapData, IlvBitmapFilter, IlvLightingFilter, IlvSpecularLightingFilter, IlvLightSource, IlvDistantLight, IlvPointLight, IlvSpotLight

Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Returns:
The diffuse constant.
void IlvDiffuseLightingFilter::setDiffuseConstant ( IlFloat  diffuse  ) 

Sets the diffuse constant value.

Parameters:
diffuse The new diffuse constant.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© 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.