NL3D::CZoneLighter::CPointLightRT Struct Reference


Detailed Description

A PointLight struct to test raytracing.

Definition at line 531 of file zone_lighter.h.

Public Member Functions

 CPointLightRT ()
bool testRaytrace (const CVector &v)

Data Fields

NLMISC::CBSphere BSphere
uint DstId
CCubeGrid< const CTriangle * > FaceCubeGrid
float OODeltaAttenuation
CPointLightNamed PointLight
uint RefCount


Constructor & Destructor Documentation

CZoneLighter::CPointLightRT::CPointLightRT  ) 
 

Definition at line 3132 of file zone_lighter.cpp.

03133 {
03134         RefCount= 0;
03135 }


Member Function Documentation

bool CZoneLighter::CPointLightRT::testRaytrace const CVector v  ) 
 

Tells if a point is visible from this light. NB: test first if in BSphere If occluded or out of radius, return false, else return true. Also Skip if the light is an Ambient, and skip if the light is a spot and if the position is out of the cone

Definition at line 3139 of file zone_lighter.cpp.

References NLMISC::CBSphere::Center, NL3D::CPointLight::computeLinearAttenuation(), NL3D::CZoneLighter::CTriangle::getPlane(), NL3D::CCubeGrid< const CTriangle * >::getSel(), NL3D::CPointLight::getType(), NLMISC::CBSphere::include(), NLMISC::CTriangle::intersect(), NL3D::CCubeGrid< const CTriangle * >::isEndSel(), NL3D::CCubeGrid< const CTriangle * >::nextSel(), NL3D::CCubeGrid< const CTriangle * >::select(), NL3D::CZoneLighter::CTriangle::Triangle, and v.

Referenced by NL3D::CZoneLighter::processZonePointLightRT().

03140 {
03141         CVector dummy;
03142 
03143         if(!BSphere.include(v))
03144                 return false;
03145 
03146         // If Ambient light, just skip
03147         if(PointLight.getType()== CPointLight::AmbientLight)
03148                 return false;
03149 
03150         // If SpotLight verify in angle radius.
03151         if(PointLight.getType()== CPointLight::SpotLight)
03152         {
03153                 float   att= PointLight.computeLinearAttenuation(v);
03154                 if (att==0)
03155                         return false;
03156         }
03157 
03158         // Select in the cubeGrid
03159         FaceCubeGrid.select(v);
03160         // For all faces selected
03161         while(!FaceCubeGrid.isEndSel())
03162         {
03163                 const CTriangle *tri= FaceCubeGrid.getSel();
03164 
03165                 // If intersect, the point is occluded.
03166                 if( tri->Triangle.intersect(BSphere.Center, v, dummy, tri->getPlane()) )
03167                         return false;
03168 
03169                 // next
03170                 FaceCubeGrid.nextSel();
03171         }
03172 
03173         // Ok the point is visilbe from the light
03174         return true;
03175 }


Field Documentation

NLMISC::CBSphere NL3D::CZoneLighter::CPointLightRT::BSphere
 

Definition at line 536 of file zone_lighter.h.

Referenced by NL3D::CZoneLighter::addStaticPointLight(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CZoneLighter::CPredPointLightToPoint::operator()(), and NL3D::CZoneLighter::processZonePointLightRT().

uint NL3D::CZoneLighter::CPointLightRT::DstId
 

Definition at line 543 of file zone_lighter.h.

Referenced by NL3D::CZoneLighter::processZonePointLightRT().

CCubeGrid<const CTriangle*> NL3D::CZoneLighter::CPointLightRT::FaceCubeGrid
 

Definition at line 539 of file zone_lighter.h.

Referenced by NL3D::CZoneLighter::compilePointLightRT().

float NL3D::CZoneLighter::CPointLightRT::OODeltaAttenuation
 

Definition at line 534 of file zone_lighter.h.

Referenced by NL3D::CZoneLighter::addStaticPointLight(), and NL3D::CZoneLighter::CPredPointLightToPoint::operator()().

CPointLightNamed NL3D::CZoneLighter::CPointLightRT::PointLight
 

Definition at line 533 of file zone_lighter.h.

Referenced by NL3D::CZoneLighter::addStaticPointLight(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CZoneLighter::CPredPointLightToPoint::operator()(), and NL3D::CZoneLighter::processZonePointLightRT().

uint NL3D::CZoneLighter::CPointLightRT::RefCount
 

Definition at line 541 of file zone_lighter.h.

Referenced by NL3D::CZoneLighter::compilePointLightRT(), and NL3D::CZoneLighter::processZonePointLightRT().


The documentation for this struct was generated from the following files:
Generated on Tue Mar 16 08:35:55 2004 for NeL by doxygen 1.3.6