Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csShadowBitmap Class Reference

This class represents a shadow-bitmap. More...

#include <polytext.h>

List of all members.

Public Methods

 csShadowBitmap (int lm_w, int lm_h, int quality, int default_light)
 Make a new shadow bitmap of the given lightmap size and quality. More...

 ~csShadowBitmap ()
 Destroy the shadow bitmap.

void RenderPolygon (csVector2 *poly, int num_vertices, int val)
 Render a polygon on this bitmap. More...

void RenderTotal (int val)
 Set the entire area of this bitmap to either completely shadowed (val==1) or fully lit (val==0).

void UpdateLightMap (csRGBpixel *lightmap, int lightcell_shift, float shf_u, float shf_v, float mul_u, float mul_v, const csMatrix3 &m_t2w, const csVector3 &v_t2w, csLight *light, const csVector3 &lightpos, const csColor &lightcolor, const csVector3 &poly_normal, float cosfact)
 Take a light and update the lightmap using the information in this shadow-bitmap. More...

void UpdateShadowMap (unsigned char *shadowmap, int lightcell_shift, float shf_u, float shf_v, float mul_u, float mul_v, const csMatrix3 &m_t2w, const csVector3 &v_t2w, csLight *light, const csVector3 &lightpos, const csVector3 &poly_normal, float cosfact)
 Take a light and update the shadowmap using the information in this shadow-bitmap. More...

bool IsFullyShadowed () const
 Return true if this bitmap is fully shadowed.

bool IsFullyUnlit () const
 Return true if this bitmap is fully unlit.

bool IsFullyLit () const
 Return true if this bitmap is fully lit.


Detailed Description

This class represents a shadow-bitmap.

It is used while calculating lighting for one light on a polygon. First shadows are collected on this bitmap. Later the bitmap will be used to update the lightmap.


Constructor & Destructor Documentation

csShadowBitmap::csShadowBitmap ( int lm_w,
int lm_h,
int quality,
int default_light )
 

Make a new shadow bitmap of the given lightmap size and quality.

Quality will be a number indicating how much we want to enhance or reduce size of this bitmap compared to the lightmap size. A quality of 0 means no change (i.e. the bitmap will hold as many shadow-points as lumels). A quality of -1 means that for every 2x2 lumels there will be one shadow-point. A quality of 1 means that one lumel corresponds with 2x2 shadow-points.


Member Function Documentation

void csShadowBitmap::RenderPolygon ( csVector2 * poly,
int num_vertices,
int val )
 

Render a polygon on this bitmap.

The coordinates of this polygon are given in lightmap coordinates. WARNING the given polygon will be modified by this function! 'val' can be 0 or 1 and will be used to fill the polygon. To render a shadow you would use 1 and for light you would use 0.

void csShadowBitmap::UpdateLightMap ( csRGBpixel * lightmap,
int lightcell_shift,
float shf_u,
float shf_v,
float mul_u,
float mul_v,
const csMatrix3 & m_t2w,
const csVector3 & v_t2w,
csLight * light,
const csVector3 & lightpos,
const csColor & lightcolor,
const csVector3 & poly_normal,
float cosfact )
 

Take a light and update the lightmap using the information in this shadow-bitmap.

  • lightcell_shift is the shift to scale lightmap space to texture space (with texture space meaning 0 to real texture size).
  • The shf_u, shf_v, mul_u, and mul_v fields define how to translate the previous texture space to uv space (where uv goes between 0 and 1 for a single texture).
  • m_t2w and v_t2w transform uv space to world space coordinates.
  • light is the light and lightpos is the position of that light (which can be different from the position of the light given by 'light' itself because we can have space warping).
  • lightcolor can also be different from the color of the light because it could in principle be modified by portals.

void csShadowBitmap::UpdateShadowMap ( unsigned char * shadowmap,
int lightcell_shift,
float shf_u,
float shf_v,
float mul_u,
float mul_v,
const csMatrix3 & m_t2w,
const csVector3 & v_t2w,
csLight * light,
const csVector3 & lightpos,
const csVector3 & poly_normal,
float cosfact )
 

Take a light and update the shadowmap using the information in this shadow-bitmap.

  • lightcell_shift is the shift to scale lightmap space to texture space (with texture space meaning 0 to real texture size).
  • The shf_u, shf_v, mul_u, and mul_v fields define how to translate the previous texture space to uv space (where uv goes between 0 and 1 for a single texture).
  • m_t2w and v_t2w transform uv space to world space coordinates.
  • light is the light and lightpos is the position of that light (which can be different from the position of the light given by 'light' itself because we can have space warping).


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000