NL3D::CInstanceLighter::CPointLightRT Struct Reference


Detailed Description

A PointLight struct to test raytracing.

Definition at line 218 of file instance_lighter.h.

Public Member Functions

 CPointLightRT ()
bool testRaytrace (const CVector &v, sint instanceComputed=-1)

Data Fields

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


Constructor & Destructor Documentation

NL3D::CInstanceLighter::CPointLightRT::CPointLightRT  ) 
 

Definition at line 947 of file instance_lighter.cpp.

References RefCount.

00948 {
00949         RefCount= 0;
00950 }


Member Function Documentation

bool NL3D::CInstanceLighter::CPointLightRT::testRaytrace const CVector v,
sint  instanceComputed = -1
 

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. if instanceComputed>=0, then skip obstacles with InstanceId==instanceComputed. 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 954 of file instance_lighter.cpp.

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

Referenced by NL3D::CInstanceLighter::processIGPointLightRT().

00955 {
00956         CVector dummy;
00957 
00958         if(!BSphere.include(v))
00959                 return false;
00960 
00961         // If Ambient light, just skip
00962         if(PointLight.getType()== CPointLight::AmbientLight)
00963                 return false;
00964 
00965         // If SpotLight verify in angle radius.
00966         if(PointLight.getType()== CPointLight::SpotLight)
00967         {
00968                 float   att= PointLight.computeLinearAttenuation(v);
00969                 if (att==0)
00970                         return false;
00971         }
00972 
00973 
00974         // Select in the cubeGrid
00975         FaceCubeGrid.select(v);
00976         // For all faces selected
00977         while(!FaceCubeGrid.isEndSel())
00978         {
00979                 const CTriangle *tri= FaceCubeGrid.getSel();
00980 
00981                 // If the triangle is not a triangle of the instance currenlty lighted
00982                 if( instanceComputed<0 || tri->InstanceId != instanceComputed )
00983                 {
00984                         // If intersect, the point is occluded.
00985                         if( tri->Triangle.intersect(BSphere.Center, v, dummy, tri->getPlane()) )
00986                                 return false;
00987                 }
00988 
00989                 // next
00990                 FaceCubeGrid.nextSel();
00991         }
00992 
00993         // Ok the point is visilbe from the light
00994         return true;
00995 }


Field Documentation

NLMISC::CBSphere NL3D::CInstanceLighter::CPointLightRT::BSphere
 

Definition at line 223 of file instance_lighter.h.

Referenced by NL3D::CInstanceLighter::addStaticPointLight(), NL3D::CInstanceLighter::compilePointLightRT(), NL3D::CInstanceLighter::CPredPointLightToPoint::operator()(), NL3D::CInstanceLighter::processIGPointLightRT(), and testRaytrace().

uint NL3D::CInstanceLighter::CPointLightRT::DstId
 

Definition at line 230 of file instance_lighter.h.

Referenced by NL3D::CInstanceLighter::processIGPointLightRT().

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

Definition at line 226 of file instance_lighter.h.

Referenced by NL3D::CInstanceLighter::compilePointLightRT(), and testRaytrace().

float NL3D::CInstanceLighter::CPointLightRT::OODeltaAttenuation
 

Definition at line 221 of file instance_lighter.h.

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

CPointLightNamed NL3D::CInstanceLighter::CPointLightRT::PointLight
 

Definition at line 220 of file instance_lighter.h.

Referenced by NL3D::CInstanceLighter::addStaticPointLight(), NL3D::CInstanceLighter::compilePointLightRT(), NL3D::CInstanceLighter::CPredPointLightToPoint::operator()(), NL3D::CInstanceLighter::processIGPointLightRT(), and testRaytrace().

uint NL3D::CInstanceLighter::CPointLightRT::RefCount
 

Definition at line 228 of file instance_lighter.h.

Referenced by NL3D::CInstanceLighter::compilePointLightRT(), CPointLightRT(), and NL3D::CInstanceLighter::processIGPointLightRT().


The documentation for this struct was generated from the following files:
Generated on Tue Mar 16 06:47:44 2004 for NeL by doxygen 1.3.6