Public Methods |
| csPolygon3D (csMaterialWrapper *mat) |
| Construct a new polygon with the given material.
|
| csPolygon3D (csPolygon3D &poly) |
| Construct a new polygon and copy from the given polygon. More...
|
virtual | ~csPolygon3D () |
| Delete everything related to this polygon. More...
|
unsigned long | GetPolygonID () |
| Get the ID of this polygon relative to the parent (will be >0).
|
void | SetTextureType (int type) |
| Set type of texturing to use for this polygon (one of the POLYTXT_??? flags). More...
|
int | GetTextureType () |
| Get the polygon texture type (one of POLYTXT_XXX values).
|
void | CopyTextureType (iPolygon3D *other_polygon) |
| Copy texture type settings from another polygon. More...
|
csPolyTexType* | GetTextureTypeInfo () |
| Get the general texture type information structure.
|
csPolyTexLightMap* | GetLightMapInfo () |
| This is a conveniance function to get the lightmap information structure. More...
|
csPolyTexGouraud* | GetGouraudInfo () |
| This is a conveniance function to get the gouraud information structure. More...
|
csPolyTexFlat* | GetFlatInfo () |
| This is a conveniance function to get the flat shaded information structure. More...
|
csPolyTexType* | GetNoTexInfo () |
| This is a conveniance function to get the "type" texturing type information structure. More...
|
void | Reset () |
| Clear the polygon (remove all vertices).
|
int | AddVertex (int v) |
| Add a vertex from the container (polygonset) to the polygon.
|
int | AddVertex (const csVector3 &v) |
| Add a vertex to the polygon (and containing thing). More...
|
int | AddVertex (float x, float y, float z) |
| Add a vertex to the polygon (and containing thing). More...
|
void | ComputeNormal () |
| Precompute the plane normal. More...
|
void | Finish () |
| After the plane normal and the texture matrices have been set up this routine makes some needed pre-calculations for this polygon. More...
|
void | SetCSPortal (csSector *sector, bool null=false) |
| If the polygon is a portal this will set the sector that this portal points to. More...
|
void | SetPortal (csPortal *prt) |
| Set a pre-created portal on this polygon.
|
csPortal* | GetPortal () |
| Get the portal structure (if there is one).
|
void | SetParent (csThing *thing) |
| Set the thing that this polygon belongs to.
|
csThing* | GetParent () |
| Get the polygonset (container) that this polygons belongs to.
|
csPolyPlane* | GetPlane () |
| Return the plane of this polygon. More...
|
csPlane3* | GetPolyPlane () |
| Return the world-space plane of this polygon.
|
csPolyIndexed& | GetVertices () |
| Get the vertices.
|
virtual int | GetVertexCount () |
| Get number of vertices (required for csPolygonInt).
|
virtual int* | GetVertexIndices () |
| Get vertex index table (required for csPolygonInt).
|
void | SetWarp (const csTransform &t) |
| Set the warping transformation for the portal. More...
|
void | SetWarp (const csMatrix3 &m_w, const csVector3 &v_w_before, const csVector3 &v_w_after) |
| Set the warping transformation for the portal. More...
|
const csVector3& | Vwor (int idx) const |
| 'idx' is a local index into the vertices table of the polygon. More...
|
const csVector3& | Vobj (int idx) const |
| 'idx' is a local index into the vertices table of the polygon. More...
|
const csVector3& | Vcam (int idx) const |
| 'idx' is a local index into the vertices table of the polygon. More...
|
void | UpdateTransformation (const csTransform &c, long cam_cameranr) |
| Before calling a series of Vcam() you should call UpdateTransformation() first to make sure that the camera vertex set is up-to-date.
|
void | WorUpdate () |
| Before calling a series of Vwor() you should call WorUpdate() first to make sure that the world vertex set is up-to-date.
|
void | SetMaterial (csMaterialWrapper *material) |
| Set the material for this polygon. More...
|
csMaterialWrapper* | GetMaterialWrapper () |
| Get the material.
|
bool | IsTransparent () |
| Return true if this polygon or the texture it uses is transparent.
|
float | GetArea () |
| Calculates the area of the polygon in object space.
|
float | GetCosinusFactor () |
| Get the cosinus factor. More...
|
void | SetCosinusFactor (float f) |
| Set the cosinus factor. More...
|
void | SetTextureSpace (csPolygon3D *copy_from) |
| One of the SetTextureSpace functions should be called after adding all vertices to the polygon (not before) and before doing any processing on the polygon (not after)! It makes sure that the plane normal is correctly computed and the texture and plane are correctly initialized. More...
|
void | SetTextureSpace (csPolyTxtPlane *txt_pl) |
| This version takes the given plane. More...
|
void | SetTextureSpace (const csVector3 &p1, const csVector2 &uv1, const csVector3 &p2, const csVector2 &uv2, const csVector3 &p3, const csVector2 &uv3) |
| Set the texture space transformation given three vertices and their uv coordinates.
|
void | SetTextureSpace (const csVector3 &v_orig, const csVector3 &v1, float len1) |
| Calculate the matrix using two vertices (which are preferably on the plane of the polygon and are possibly (but not necessarily) two vertices of the polygon). More...
|
void | SetTextureSpace (float xo, float yo, float zo, float x1, float y1, float z1, float len1) |
| Calculate the matrix using two vertices (which are preferably on the plane of the polygon and are possibly (but not necessarily) two vertices of the polygon). More...
|
void | SetTextureSpace (const csVector3 &v_orig, const csVector3 &v1, float len1, const csVector3 &v2, float len2) |
| Calculate the matrix using 'v1' and 'len1' for the u-axis and 'v2' and 'len2' for the v-axis.
|
void | SetTextureSpace (float xo, float yo, float zo, float x1, float y1, float z1, float len1, float x2, float y2, float z2, float len2) |
| The same but all in floats.
|
void | SetTextureSpace (csMatrix3 const &, csVector3 const &) |
| The most general function. More...
|
csPolygonInt* | GetUnsplitPolygon () |
| Return the pointer to the original polygon (before any BSP splits).
|
csPolygon3D* | GetBasePolygon () |
| Return the pointer to the original polygon (before any BSP splits). More...
|
void | MakeDirtyDynamicLights () |
| A dynamic light has changed (this can be either an intensity/color change of a pseudo-dynamic light or else a real dynamic light change).
|
bool | IsDirty () |
| Return true if polygon is dirty for dynamic lights.
|
void | MakeCleanDynamicLights () |
| Make clean again.
|
void | UnlinkLightpatch (csLightPatch *lp) |
| Unlink a light patch from the light patch list. More...
|
void | AddLightpatch (csLightPatch *lp) |
| Add a light patch to the light patch list.
|
csLightPatch* | GetLightpatches () |
| Get the list of light patches for this polygon.
|
void | ClipPolyPlane (csVector3 *verts, int *num, bool mirror, csVector3 &v1, csVector3 &v2) |
| Clip a polygon against a plane (in camera space). More...
|
void | InitializeDefault () |
| Initialize the lightmaps for this polygon. More...
|
bool | ReadFromCache (iCacheManager *cache_mgr, int id) |
| This function will try to read the lightmap from the cache in the level archive. More...
|
bool | WriteToCache (iCacheManager *cache_mgr, int id) |
| Call after calling InitializeDefault() and CalculateLighting to cache the calculated lightmap to the level archive. More...
|
void | PrepareLighting () |
| Prepare the lightmaps for use. More...
|
void | FillLightMapDynamic (csFrustumView &lview) |
| Fill the lightmap of this polygon according to the given light and the frustum. More...
|
void | FillLightMapStatic (csFrustumView *lview, bool vis) |
| Fill the lightmap of this polygon according to the given light and the frustum. More...
|
void | UpdateVertexLighting (iLight *light, const csColor &lcol, bool dynamic, bool reset) |
| Update vertex lighting for this polygon. More...
|
bool | MarkRelevantShadowFrustums (csFrustumView &lview, csPlane3 &plane) |
| Check all shadow frustums and mark all relevant ones. More...
|
bool | MarkRelevantShadowFrustums (csFrustumView &lview) |
| Same as above but takes polygon plane as 'plane' argument.
|
void | CalculateLightingDynamic (csFrustumView *lview) |
| Check visibility of this polygon with the given csFrustumView and update the light patches if needed. More...
|
void | CalculateLightingStatic (csFrustumView *lview, bool vis) |
| Check visibility of this polygon with the given csFrustumView and fill the lightmap if needed (this function calls FillLightMap ()). More...
|
void | ObjectToWorld (const csReversibleTransform &t, const csVector3 &vwor) |
| Transform the plane of this polygon from object space to world space. More...
|
void | HardTransform (const csReversibleTransform &t) |
| Hard transform the plane of this polygon and also the portal and lightmap info. More...
|
bool | ClipToPlane (csPlane3 *portal_plane, const csVector3 &v_w2c, csVector3 *&pverts, int &num_verts, bool cw=true) |
| Clip this camera space polygon to the given plane. More...
|
bool | DoPerspective (const csTransform &trans, csVector3 *source, int num_verts, csPolygon2D *dest, csVector2 *orig_triangle, bool mirror) |
| This is the link between csPolygon3D and csPolygon2D (see below for more info about csPolygon2D). More...
|
virtual int | Classify (const csPlane3 &pl) |
| Classify this polygon with regards to a plane (in object space). More...
|
virtual int | ClassifyX (float x) |
| Same as Classify() but for X plane only.
|
virtual int | ClassifyY (float y) |
| Same as Classify() but for Y plane only.
|
virtual int | ClassifyZ (float z) |
| Same as Classify() but for Z plane only.
|
virtual void | SplitWithPlane (csPolygonInt **front, csPolygonInt **back, const csPlane3 &plane) |
| Split this polygon with the given plane (A,B,C,D) and return the two resulting new polygons in 'front' and 'back'. More...
|
virtual bool | Overlaps (csPolygonInt *overlapped) |
| Check if this polygon (partially) overlaps the other polygon from some viewpoint in space. More...
|
virtual int | GetType () |
| Return 1 to indicate to the BSP tree routines that this is a csPolygon3D.
|
bool | IntersectSegment (const csVector3 &start, const csVector3 &end, csVector3 &isect, float *pr=NULL) |
| Intersect object-space segment with this polygon. More...
|
bool | IntersectRay (const csVector3 &start, const csVector3 &end) |
| Intersect object-space ray with this polygon. More...
|
bool | IntersectRayNoBackFace (const csVector3 &start, const csVector3 &end) |
| Intersect object-space ray with this polygon. More...
|
bool | IntersectRayPlane (const csVector3 &start, const csVector3 &end, csVector3 &isect) |
| Intersect object space ray with the plane of this polygon and returns the intersection point. More...
|
bool | PointOnPolygon (const csVector3 &v) |
| This is a given point is on (or very nearly on) this polygon. More...
|
virtual int | GetAlpha () |
| Get the alpha transparency value for this polygon.
|
virtual void | SetAlpha (int iAlpha) |
| Set the alpha transparency value for this polygon (only if it is a portal). More...
|
virtual iMaterialHandle* | GetMaterialHandle () |
| Get the material handle for the texture manager.
|
virtual iPolygonTexture* | GetTexture () |
| Get the handle to the polygon texture object.
|
csPolygon3D* | GetNextShare () |
| Get next polygon in texture share list.
|
void | SetNextShare (csPolygon3D *next) |
| Set next polygon in texture share list.
|
| SCF_DECLARE_IBASE_EXT (csObject) |
Public Attributes |
csFlags | flags |
| Set of flags.
|
csPolygon3D::eiPolygon3D | scfiPolygon3D |
Friends |
class | csPolyTexture |
class | eiPolygon3D |
Polygons are used to construct the outer hull of sectors and the faces of 3D things. Polygons can be transformed in 3D (usually they are transformed so that the camera position is at (0,0,0) and the Z-axis is forward). Polygons cannot be transformed in 2D. That's what csPolygon2D is for. It is possible to convert a csPolygon3D to a csPolygon2D though, at which point processing continues with the csPolygon2D object.
Polygons have a texture and lie on a plane. The plane does not define the orientation of the polygon but is derived from it. The plane does define how the texture is scaled and translated accross the surface of the polygon (in case we are talking about lightmapped polygons, gouraud shaded polygons have u,v coordinates at every vertex). Several planes can be shared for different polygons. As a result of this their textures will be correctly aligned.
If a polygon is part of a sector it can be a portal to another sector. A portal-polygon is a see-through polygon that defines a view to another sector. Normally the texture for a portal-polygon is not drawn unless the texture is filtered in which case it is drawn on top of the other sector.