Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csRadElement Class Reference

A radiosity Element, containing lightmap patches, the lumels. More...

#include <radiosty.h>

Inheritance diagram for csRadElement:

csObject iObject iBase csRadCurve csRadPoly List of all members.

Public Methods

 csRadElement ()
 ~csRadElement ()
float GetPriority ()
 for queueing of elements to shoot their light.

float GetArea () const
 get area size of element, precomputed.

float GetDiffuse () const
 Get diffuse reflection value for element. 0.55-0.75 is nice.

int GetWidth () const
 get width of lightmap and deltamap.

int GetHeight () const
 get height of lightmap and deltamap.

int GetSize () const
 get size of lightmap and deltamap.

bool DeltaIsZero (int suv)
 check if a delta lumel is zero.

virtual csSectorGetSector () const=0
 return the sector of this element.

virtual const csVector3GetNormal (int x, int y) const=0
 return the normal at the point x, y.

csVector3 GetAvgNormal () const
 return the average normal for this element.

bool DeltaIsZero (int suv, int w, int h)
 check if a patch has zero delta.

void GetTextureColour (int suv, int w, int h, csColor &avg, csRGBMap *texturemap)
 Get avg texture colour for a patch.

void CapDelta (int suv, int w, int h, float max)
 Cap every delta in patch to value.

void GetSummedDelta (int suv, int w, int h, csColor &sum)
 Get the summed delta of a patch.

csRGBFloatLightMapGetDeltaMap ()
 get the delta map.

void ShowDeltaMap ()
 For debugging: keep a pointer of the static lightmap and temporarily copy the deltamap to the static lightmap again.

void RestoreStaticMap ()
 For debugging: restore the state of the static lightmaps and free the copy of the static lightmap.

float GetLastShootingPriority ()
 Get last shooting priority of this radpoly.

void SetLastShootingPriority (float val)
 Set last shooting priority.

int GetRepeatCount ()
 Get number of repeats shooting at the same priority for this poly.

void IncNumRepeats ()
 Increment the number of repeats of shooting at same priority by one.

virtual void Lumel2World (csVector3 &res, int x, int y)=0
 Get world coordinates for a lumel.

float GetOneLumelArea () const
 get area of one lumel in world space.

virtual void GetCoverageMatrix (csFrustumView *lview, csCoverageMatrix *shadow_matrix)=0
 Populates the shadow coverage Matrix for this element.

void ComputePriority ()
 computes new priority value, summing the light unshot. More...

void AddDelta (csRadElement *src, int suv, int ruv, float fraction, const csColor &filtercolor)
 Add a fraction to delta map of lumel from given source RadPoly. More...

void AddToDelta (int ruv, const csColor &value)
 Add a value *to* the deltamap.

void CopyAndClearDelta ()
 light has been shot, copy delta to lightmap, clear delta, recompute priority. More...

void GetDeltaSums (float &red, float &green, float &blue)
 Get the sums of red.green.blue in the delta map.

void ApplyAmbient (int red, int green, int blue)
 Add ambient value to deltamap.

csRGBMap* ComputeTextureLumelSized ()
 Compute the texture map at the size of the lumel map. More...


Public Attributes

csLightMapcsmap

Static Public Methods

csRadElement* GetRadElement (csPolygon3D &object)
 Get a RadElement when you have a csPolygon3D or a csCurve.

csRadElement* GetRadElement (csCurve &object)
 Get a RadElement.


Protected Methods

virtual iMaterialWrapperGetMaterialWrapper ()=0
 return the material handle.

virtual csColor GetFlatColor () const=0
 return the flat color value.

virtual void Setup ()

Protected Attributes

float area
float total_unshot_light
int width
int height
int size
csRGBMap* lightmap
 ptr to static lightmap of polygon.

csRGBFloatLightMapdeltamap
 the change to this lightmap, unshot light.

csRGBMap* copy_lightmap
 if we are debugging radiosity then this is a copy of the lightmap that we store in order to restore the static lightmap values later.

float one_lumel_area
 the area of one lumel of the polygon.

float last_shoot_priority
 values for loop detection, last shooting priority and repeats.

int num_repeats

Detailed Description

A radiosity Element, containing lightmap patches, the lumels.

Radiosity rendering specific info is kept here.


Member Function Documentation

void csRadElement::AddDelta ( csRadElement * src,
int suv,
int ruv,
float fraction,
const csColor & filtercolor )
 

Add a fraction to delta map of lumel from given source RadPoly.

suv is index in src, ruv is index in maps of this poly.

void csRadElement::ComputePriority ( )
 

computes new priority value, summing the light unshot.

Note: Do no touch the variable total_unshot_light without doing a list->Delete(this), beforehand.

csRGBMap * csRadElement::ComputeTextureLumelSized ( )
 

Compute the texture map at the size of the lumel map.

Gets the texture, and scales down. You must delete the map.

void csRadElement::CopyAndClearDelta ( )
 

light has been shot, copy delta to lightmap, clear delta, recompute priority.

(this radpoly may not be in list as the total_unshot_light value changes).


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