![]() |
Public API Reference |
#include <sector.h>
Inheritance diagram for csSector:
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... | |
iLightList * | GetLights () |
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... | |
iVisibilityCuller * | GetVisibilityCuller () |
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... | |
iPolygon3D * | HitBeam (const csVector3 &start, const csVector3 &end, csVector3 &isect) |
Follow a beam from start to end and return the first polygon that is hit. More... | |
csMeshWrapper * | 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. 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... | |
iPolygon3D * | IntersectSphere (csVector3 ¢er, 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... | |
iPolygon3D * | 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. 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... | |
csKDTree * | GetLightKDTree () const |
Get the kdtree for the light list. More... | |
csEngine * | GetEngine () const |
Get the engine for this sector. More... | |
bool | HasFog () const |
Return true if this has fog. More... | |
csFog & | GetFog () |
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... |
It is one of the base classes for the portal engine.
Definition at line 102 of file csengine/sector.h.
|
Construct a sector. This sector will be completely empty. |
|
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. |
|
Check visibility in a frustum way for all things and polygons in this sector and possibly traverse through portals to other sectors.
|
|
This function MUST be called before the sector is deleted in order to make sure that all references to the sector are cleaned up.
|
|
Disable fog.
Definition at line 476 of file csengine/sector.h. References csFog::enabled. |
|
Draw the sector in the given view and with the given transformation.
|
|
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. |
|
Get the engine for this sector.
Definition at line 456 of file csengine/sector.h. |
|
Return fog structure.
Definition at line 463 of file csengine/sector.h. |
|
Get the kdtree for the light list.
Definition at line 449 of file csengine/sector.h. References csSectorLightList::GetLightKDTree. |
|
Get the list of lights in this sector.
Definition at line 261 of file csengine/sector.h. |
|
Get the visibility culler that is used for this sector. NULL if none. |
|
Return true if this has fog.
Definition at line 460 of file csengine/sector.h. References csFog::enabled. |
|
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. |
|
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. |
|
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. |
|
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. |
|
Prepare this sector for drawing.
|
|
Prepare a mesh for rendering. This function is called for all meshes that are added to the sector. |
|
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. |
|
Register a mesh and all children to the visibility culler.
|
|
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. |
|
Sets dynamic ambient light for all things in the sector.
|
|
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. |
|
Version of shine_lights() which only affects one mesh object.
|
|
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. |
|
Unprepare a mesh. This function is called for all meshes that are removed from the sector. |
|
Unregister a mesh and all children from the visibility culler.
|
|
Use the given plugin as a visibility culler (should implement iVisibilityCuller). Returns false if the culler could not be loaded for some reason. |
|
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. |
|
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. |
|
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. |
|
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. |