CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File 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. More...

void RegisterMeshToCuller (iMeshWrapper *mesh)
 Register a mesh and all children to the visibility culler. More...

void UnregisterMeshToCuller (iMeshWrapper *mesh)
 Unregister a mesh and all children from the visibility culler. More...

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. More...

bool UseCullerPlugin (const char *plugname)
 Use the given plugin as a visibility culler (should implement iVisibilityCuller). More...

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

void PrepareDraw (iRenderView *rview)
 Prepare this sector for drawing. More...

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

iPolygon3DHitBeam (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, iPolygon3D **polygonPtr, bool accurate=false)
 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. More...

iPolygon3DIntersectSphere (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...

iPolygon3DIntersectSegment (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. More...

void SetDynamicAmbientLight (const csColor &color)
 Sets dynamic ambient light for all things in the sector. More...

csKDTreeGetLightKDTree () const
 Get the kdtree for the light list. More...

csEngineGetEngine () const
 Get the engine for this sector. More...

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

csFogGetFog ()
 Return fog structure. More...

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

void DisableFog ()
 Disable fog. More...


Public Attributes

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


Static Public Attributes

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

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...


Detailed Description

A sector is a container for objects.

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

Definition at line 102 of file csengine/sector.h.


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.

void csSector::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.

void csSector::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.

void csSector::DisableFog   [inline]
 

Disable fog.

Definition at line 476 of file csengine/sector.h.

References csFog::enabled.

void csSector::Draw iRenderView   rview
 

Draw the sector in the given view and with the given transformation.

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.

csEngine* csSector::GetEngine   const [inline]
 

Get the engine for this sector.

Definition at line 456 of file csengine/sector.h.

csFog& csSector::GetFog   [inline]
 

Return fog structure.

Definition at line 463 of file csengine/sector.h.

csKDTree* csSector::GetLightKDTree   const [inline]
 

Get the kdtree for the light list.

Definition at line 449 of file csengine/sector.h.

References csSectorLightList::GetLightKDTree.

iLightList* csSector::GetLights   [inline]
 

Get the list of lights in this sector.

Definition at line 261 of file csengine/sector.h.

iVisibilityCuller* csSector::GetVisibilityCuller  
 

Get the visibility culler that is used for this sector.

NULL if none.

bool csSector::HasFog   const [inline]
 

Return true if this has fog.

Definition at line 460 of file csengine/sector.h.

References csFog::enabled.

csMeshWrapper* csSector::HitBeam const csVector3   start,
const csVector3   end,
csVector3   intersect,
iPolygon3D **    polygonPtr,
bool    accurate = false
 

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

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

iPolygon3D* 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.

iPolygon3D* 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.

iPolygon3D* 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::PrepareDraw iRenderView   rview
 

Prepare this sector for drawing.

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::RegisterMeshToCuller iMeshWrapper   mesh
 

Register a mesh and all children to the visibility culler.

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::SetDynamicAmbientLight const csColor   color
 

Sets dynamic ambient light for all things in the sector.

void csSector::SetFog float    density,
const csColor   color
[inline]
 

Conveniance function to set fog to some setting.

Definition at line 466 of file csengine/sector.h.

References csColor::blue, csFog::blue, csFog::density, csFog::enabled, csColor::green, csFog::green, csColor::red, and csFog::red.

void csSector::ShineLights iMeshWrapper  ,
csProgressPulse   = 0
 

Version of shine_lights() which only affects one mesh object.

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::UnregisterMeshToCuller iMeshWrapper   mesh
 

Unregister a mesh and all children from the visibility culler.

bool csSector::UseCullerPlugin const char *    plugname
 

Use the given plugin as a visibility culler (should implement iVisibilityCuller).

Returns false if the culler could not be loaded for some reason.


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.

Definition at line 187 of file csengine/sector.h.

bool csSector::do_portals [static]
 

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

Definition at line 179 of file csengine/sector.h.

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.

Definition at line 196 of file csengine/sector.h.

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.

Definition at line 204 of file csengine/sector.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.14