Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

D3D9
[RpLight]


Data Structures

struct  RpD3D9AttenuationParams

Functions

void RpD3D9LightSetAttenuationParams (RpLight *light, const RpD3D9AttenuationParams *params)
void RpD3D9LightGetAttenuationParams (const RpLight *light, RpD3D9AttenuationParams *params)

Detailed Description

Platform specific

Lighting

RWD3D9 can create any number of lights. For video cards supporting hardware TnL, all lights will be in hardware but it is dependent on the driver as to how many are supported and how any lights beyond that limit are handled. Non-TnL video cards do not have this restriction. As a performance restriction it is recommended that a maximum of 9 lights are used.

RenderWare Graphics sums all ambient lights and sets the summed color as the constant ambient. rpLIGHTPOINT, rpLIGHTSPOT and rpLIGHTSPOTSOFT do not match generic RenderWare lighting equations but are close approximations.

Note that the lighting attenuation function used in D3D9 is different to that used in RenderWare. The function used in RWD3D9 is


                     1
    -----------------------------------
          L            Q
     C + --- * D + --------- * (D * D)
          R         (R * R)
   

where D is the distance to the vertex from the light source, R is the radius of the light and C, L and Q are the constant, linear and quadratic attenuation parameters, respectively.

The attentuation parameters are set by default to C = 1, L = 0, Q = 5.

See also:
RpLightCreate , RpLightSetRadius , RpD3D9LightGetAttenuationParams , RpD3D9LightSetAttenuationParams , Platform Specific Functions , D3D9 Features & Restrictions

Function Documentation

void RpD3D9LightGetAttenuationParams const RpLight   light,
RpD3D9AttenuationParams   params
 

RpD3D9LightGetAttenuationParams is used to retrieve the attenuation parameters of the specified light.

The world plugin must be attached before using this function.

Parameters:
light  Constant pointer to the light.
params  Pointer to a RpD3D9AttenuationParams structure that is filled with the retrieved attenuation parameters of the light.
See also:
RpD3D9LightSetAttenuationParams

void RpD3D9LightSetAttenuationParams RpLight   light,
const RpD3D9AttenuationParams   params
 

RpD3D9LightSetAttenuationParams is used to set the attenuation model of the supplied spot or point light. The default model specifies constant, linear and quadratic attenuation coefficients to be 1, 0, 5 respectively. The attenuation parameters are used as follows:


                     1
    -----------------------------------
          L            Q
     C + --- * D + --------- * (D * D)
          R         (R * R)
   

where D is the distance to the vertex from the light source, R is the radius of the light and C, L and Q are the constant, linear and quadratic attenuation parameters, respectively.

The world plugin must be attached before using this function.

Parameters:
light  Pointer to the light whose attenuation parameters are going to be changed.
params  Constant pointer to the RpD3D9AttenuationParams.
See also:
RpD3D9LightGetAttenuationParams


Criterion Software © 1993-2004 Criterion Software Limited. All rights reserved. Built Thu Feb 12 13:46:57 2004. Send Feedback