Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csSector Class Reference

A sector is a container for objects. More...

#include <sector.h>

Inheritance diagram for csSector:

csObject iObject iBase List of all members.

Public Methods

 csSector (csEngine *)
 Construct a sector. More...

void CleanupReferences ()
 This function MUST be called before the sector is deleted in order to make sure that all references to the sector are cleaned up.

iMeshListGetMeshes ()
void PrepareMesh (iMeshWrapper *mesh)
 Prepare a mesh for rendering. More...

void UnprepareMesh (iMeshWrapper *mesh)
 Unprepare a mesh. More...

void RelinkMesh (iMeshWrapper *mesh)
 Relink a mesh from this sector. More...

iLightListGetLights ()
 Get the list of lights in this sector.

iMeshWrapperGetCullerMesh () const
 Get the mesh which implements the visibility culler.

void UseCuller (const char *meshname)
 Look for the mesh object and see if it implements iVisibilityCuller. More...

iVisibilityCullerGetVisibilityCuller () const
 Get the visibility culler that is used for this sector. More...

void Draw (iRenderView *rview)
 Draw the sector in the given view and with the given transformation.

csPolygon3DHitBeam (const csVector3 &start, const csVector3 &end, csVector3 &isect)
 Follow a beam from start to end and return the first polygon that is hit. More...

csMeshWrapperHitBeam (const csVector3 &start, const csVector3 &end, csVector3 &intersect, csPolygon3D **polygonPtr)
 Follow a beam from start to end and return the first object that is hit. More...

void RealCheckFrustum (iFrustumView *lview)
 Check visibility in a frustum way for all things and polygons in this sector and possibly traverse through portals to other sectors. More...

void CheckFrustum (iFrustumView *lview)
 Check visibility in a frustum way for all things and polygons in this sector and possibly traverse through portals to other sectors.

csObject** GetVisibleObjects (iFrustumView *lview, int &num_objects)
 Get a list of all objects which are visible in the given frustum. More...

csPolygon3DIntersectSphere (csVector3 &center, float radius, float *pr=NULL)
 Intersects world-space sphere with polygons of this set. More...

csSector* FollowSegment (csReversibleTransform &t, csVector3 &new_position, bool &mirror, bool only_portals=false)
 Follow a segment starting at this sector. More...

csPolygon3DIntersectSegment (const csVector3 &start, const csVector3 &end, csVector3 &isect, float *pr=NULL, bool only_portals=false, csMeshWrapper **p_mesh=NULL)
 Intersect world-space segment with polygons of this sector. More...

void CalculateSectorBBox (csBox3 &bbox, bool do_meshes) const
 Calculate the bounding box of all objects in this sector. More...

void ShineLights (csProgressPulse *=0)
 The whole setup starts with csEngine::shine_lights calling csSector::shine_lights for every sector in the engine. More...

void ShineLights (iMeshWrapper *, csProgressPulse *=0)
 Version of shine_lights() which only affects one mesh object.

csEngineGetEngine () const
 Get the engine for this sector.

bool HasFog () const
 Return true if this has fog.

csFogGetFog ()
 Return fog structure.

void SetFog (float density, const csColor &color)
 Conveniance function to set fog to some setting.

void DisableFog ()
 Disable fog.

 SCF_DECLARE_IBASE_EXT (csObject)

Public Attributes

int draw_busy
 How many times are we busy drawing this sector (recursive). More...

csSector::ReferencedObject  scfiReferencedObject
csSector::eiSector  scfiSector

Static Public Attributes

bool do_portals
 Option variable: render portals? If this variable is false portals are rendered as a solid polygon.

int cfg_reflections
 Configuration variable: number of allowed reflections for static lighting. More...

bool do_radiosity
 Option variable: do pseudo-radiosity? When pseudo-radiosity is enabled every polygon behaves as if it is a mirroring portal when lighting calculations are concerned. More...


Friends

class  ReferencedObject
class  eiSector

Detailed Description

A sector is a container for objects.

It is one of the base classes for the portal engine.


Constructor & Destructor Documentation

csSector::csSector ( csEngine * )
 

Construct a sector.

This sector will be completely empty.


Member Function Documentation

void csSector::CalculateSectorBBox ( csBox3 & bbox,
bool do_meshes ) const
 

Calculate the bounding box of all objects in this sector.

This function is not very efficient as it will traverse all objects in the sector one by one and compute a bounding box from that.

csSector * csSector::FollowSegment ( csReversibleTransform & t,
csVector3 & new_position,
bool & mirror,
bool only_portals = false )
 

Follow a segment starting at this sector.

If the segment intersects with a polygon it will stop there unless the polygon is a portal in which case it will recursively go to that sector (possibly applying warping transformations) and continue there.

This routine will modify all the given parameters to reflect space warping. These should be used as the new camera transformation when you decide to really go to the new position.

This function returns the resulting sector and new_position will be set to the last position that you can go to before hitting a wall.

If only_portals is true then only portals will be checked. This means that intersection with normal polygons is not checked. This is a lot faster but it does mean that you need to use another collision detection system to test with walls.

iVisibilityCuller * csSector::GetVisibilityCuller ( ) const [inline]
 

Get the visibility culler that is used for this sector.

NULL if none.

csObject ** csSector::GetVisibleObjects ( iFrustumView * lview,
int & num_objects )
 

Get a list of all objects which are visible in the given frustum.

Return an array to pointers to visible objects. You must delete this array after you are ready using it. @@ When csThing becomes a mesh object then change rc to csMeshWrapper**

csMeshWrapper * csSector::HitBeam ( const csVector3 & start,
const csVector3 & end,
csVector3 & intersect,
csPolygon3D ** polygonPtr )
 

Follow a beam from start to end and return the first object that is hit.

In case it is a thing the csPolygon3D field will be filled with the polygon that was hit. If polygonPtr is null then the polygon will not be filled in.

csPolygon3D * csSector::HitBeam ( const csVector3 & start,
const csVector3 & end,
csVector3 & isect )
 

Follow a beam from start to end and return the first polygon that is hit.

This function correctly traverse portals and space warping portals. Normally the sector you call this on should be the sector containing the 'start' point. 'isect' will be the intersection point if a polygon is returned.

csPolygon3D * csSector::IntersectSegment ( const csVector3 & start,
const csVector3 & end,
csVector3 & isect,
float * pr = NULL,
bool only_portals = false,
csMeshWrapper ** p_mesh = NULL )
 

Intersect world-space segment with polygons of this sector.

Return polygon it intersects with (or NULL) and the intersection point in world coordinates.

If 'pr' != NULL it will also return a value between 0 and 1 indicating where on the 'start'-'end' vector the intersection happened.

This function is an extension of csPolygonSet::intersect_segment in that it will also test for hits against things.

If 'only_portals' == true only portals are checked.

If 'mesh' != NULL the mesh will be filled in.

csPolygon3D * csSector::IntersectSphere ( csVector3 & center,
float radius,
float * pr = NULL )
 

Intersects world-space sphere with polygons of this set.

Return polygon it hits with (or NULL) and the intersection point in world coordinates. It will also return the polygon with the closest hit (the most nearby polygon). If 'pr' != NULL it will also return the distance where the intersection happened. Note. This function correctly accounts for portal polygons and could thus return a polygon not belonging to this sector.

void csSector::PrepareMesh ( iMeshWrapper * mesh )
 

Prepare a mesh for rendering.

This function is called for all meshes that are added to the sector.

void csSector::RealCheckFrustum ( iFrustumView * lview )
 

Check visibility in a frustum way for all things and polygons in this sector and possibly traverse through portals to other sectors.

This version doesn't init the 2D culler cube so it can be used for recursing.

void csSector::RelinkMesh ( iMeshWrapper * mesh )
 

Relink a mesh from this sector.

This is mainly useful if characterics of the mesh changed (like render priority) so that the sector needs to know this.

void csSector::ShineLights ( csProgressPulse * = 0 )
 

The whole setup starts with csEngine::shine_lights calling csSector::shine_lights for every sector in the engine.

This function will call csStatLight::shine_lightmaps for every light in the sector. csStatLight::shine_light will generate a view frustum from the center of the light and use that to light all polygons that are hit by the frustum.

void csSector::UnprepareMesh ( iMeshWrapper * mesh )
 

Unprepare a mesh.

This function is called for all meshes that are removed from the sector.

void csSector::UseCuller ( const char * meshname )
 

Look for the mesh object and see if it implements iVisibilityCuller.

If so then use it for visibility culling in this sector.


Member Data Documentation

int csSector::cfg_reflections [static]
 

Configuration variable: number of allowed reflections for static lighting.

This option controls how many time a given sector may be visited by the same beam of light. When this value is 1 it means that light is not reflected.

bool csSector::do_radiosity [static]
 

Option variable: do pseudo-radiosity? When pseudo-radiosity is enabled every polygon behaves as if it is a mirroring portal when lighting calculations are concerned.

This simulates radiosity because light reflects from every surface. The number of reflections allowed is controlled by cfg_reflections.

int csSector::draw_busy
 

How many times are we busy drawing this sector (recursive).

This is an important variable as it indicates to 'new_transformation' which set of camera vertices it should use.


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