Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

iPolygon3D Struct Reference

This is the interface to 3D polygons. More...

#include <polygon.h>

Inheritance diagram for iPolygon3D:

iBase List of all members.

Public Methods

virtual csPolygon3DGetPrivateObject ()=0
 @ UGLY! Used by engine to retrieve internal object structure. More...

virtual iObjectQueryObject ()=0
 Get the iObject for this polygon.

virtual iThingStateGetParent ()=0
 Get the thing (container) that this polygon belongs to. More...

virtual iLightMapGetLightMap ()=0
 Get the lightmap associated with this polygon.

virtual iPolygonTextureGetTexture ()=0
 Get the handle to the polygon texture object.

virtual iMaterialHandleGetMaterialHandle ()=0
 Get the material handle for the texture manager.

virtual void SetMaterial (iMaterialWrapper *mat)=0
 Set the material for this polygon.

virtual iMaterialWrapperGetMaterial ()=0
 Get the material for this polygon.

virtual int GetVertexCount ()=0
 Query number of vertices in this polygon.

virtual int* GetVertexIndices ()=0
 Get the vertex indices array.

virtual const csVector3GetVertex (int idx) const=0
 Get the given polygon vertex coordinates in object space.

virtual const csVector3GetVertexW (int idx) const=0
 Get the given polygon vertex coordinates in world space.

virtual const csVector3GetVertexC (int idx) const=0
 Get the given polygon vertex coordinates in camera space.

virtual int CreateVertex (int idx)=0
 Create a polygon vertex given his index in parent polygon set.

virtual int CreateVertex (const csVector3 &iVertex)=0
 Create a polygon vertex and add it to parent object.

virtual int GetAlpha ()=0
 Get the alpha transparency value for this polygon.

virtual void SetAlpha (int iAlpha)=0
 Set the alpha transparency value for this polygon. More...

virtual void CreatePlane (const csVector3 &iOrigin, const csMatrix3 &iMatrix)=0
 Create a private polygon texture mapping plane.

virtual bool SetPlane (const char *iName)=0
 Set polygon texture mapping plane.

virtual csFlagsGetFlags ()=0
 Set polygon flags (see CS_POLY_... values above).

virtual void SetLightingMode (bool iGouraud)=0
 Set Gouraud vs lightmap polygon lighting.

virtual iPortalCreateNullPortal ()=0
 Create a null pointer pointing to no sector. More...

virtual iPortalCreatePortal (iSector *iTarget)=0
 Create a portal object pointing to given sector.

virtual iPortalGetPortal ()=0
 Return the pointer to the portal if there is one.

virtual void SetTextureSpace (const csVector3 &p1, const csVector2 &uv1, const csVector3 &p2, const csVector2 &uv2, const csVector3 &p3, const csVector2 &uv3)=0
 Set the texture space transformation given three vertices and their uv coordinates.

virtual void SetTextureSpace (const csVector3 &v_orig, const csVector3 &v1, float l1)=0
 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...

virtual void SetTextureSpace (const csVector3 &v_orig, const csVector3 &v1, float len1, const csVector3 &v2, float len2)=0
 Calculate the matrix using 'v1' and 'len1' for the u-axis and 'v2' and 'len2' for the v-axis.

virtual void SetTextureSpace (csMatrix3 const &, csVector3 const &)=0
 The most general function. More...

virtual void SetTextureSpace (iPolyTxtPlane *plane)=0
 With this function you let this polygon share the given plane.

virtual void SetTextureType (int type)=0
 Set type of texturing to use for this polygon (one of the POLYTXT_??? flags). More...

virtual void CopyTextureType (iPolygon3D *other_polygon)=0
 Copy texture type settings from another polygon. More...

virtual int GetTextureType ()=0
 Get the polygon texture type (one of POLYTXT_XXX values).

virtual const csPlane3GetWorldPlane ()=0
 Get world space plane.

virtual const csPlane3GetObjectPlane ()=0
 Get object space plane.

virtual const csPlane3GetCameraPlane ()=0
 Get camera space plane.

virtual bool IsTransparent ()=0
 Return true if this polygon or the texture it uses is transparent.

virtual float GetCosinusFactor ()=0
 Get cosinus factor.

virtual void SetCosinusFactor (float cosfact)=0
 Set cosinus factor.

virtual iPolyTexTypeGetPolyTexType ()=0
 Get the polygon texture type.

virtual void UpdateVertexLighting (iLight *light, const csColor &lcol, bool dynamic, bool reset)=0
 Update vertex lighting for this polygon. More...

virtual unsigned long GetPolygonID ()=0
 Get a unique ID for this polygon. More...

virtual bool IntersectSegment (const csVector3 &start, const csVector3 &end, csVector3 &isect, float *pr=NULL)=0
 Intersect object-space segment with this polygon. More...

virtual bool IntersectRay (const csVector3 &start, const csVector3 &end)=0
 Intersect object-space ray with this polygon. More...

virtual bool IntersectRayNoBackFace (const csVector3 &start, const csVector3 &end)=0
 Intersect object-space ray with this polygon. More...

virtual bool IntersectRayPlane (const csVector3 &start, const csVector3 &end, csVector3 &isect)=0
 Intersect object space ray with the plane of this polygon and returns the intersection point. More...

virtual bool PointOnPolygon (const csVector3 &v)=0
 This is a given point is on (or very nearly on) this polygon. More...


Detailed Description

This is the interface to 3D polygons.


Member Function Documentation

void iPolygon3D::CopyTextureType ( iPolygon3D * other_polygon ) [pure virtual]
 

Copy texture type settings from another polygon.

(this will not copy the actual material that is used, just the information on how to apply that material to the polygon).

iPortal * iPolygon3D::CreateNullPortal ( ) [pure virtual]
 

Create a null pointer pointing to no sector.

It is preferably to set a missing sector callback on the returned portal.

iThingState * iPolygon3D::GetParent ( ) [pure virtual]
 

Get the thing (container) that this polygon belongs to.

The reference counter on iThingState is NOT incremented.

unsigned long iPolygon3D::GetPolygonID ( ) [pure virtual]
 

Get a unique ID for this polygon.

This is only unique relative to the polygon parent.

csPolygon3D * iPolygon3D::GetPrivateObject ( ) [pure virtual]
 

@ UGLY! Used by engine to retrieve internal object structure.

@

bool iPolygon3D::IntersectRay ( const csVector3 & start,
const csVector3 & end ) [pure virtual]
 

Intersect object-space ray with this polygon.

This function is similar to IntersectSegment except that it doesn't keep the lenght of the ray in account. It just tests if the ray intersects with the interior of the polygon. Note that this function also does back-face culling.

bool iPolygon3D::IntersectRayNoBackFace ( const csVector3 & start,
const csVector3 & end ) [pure virtual]
 

Intersect object-space ray with this polygon.

This function is similar to IntersectSegment except that it doesn't keep the lenght of the ray in account. It just tests if the ray intersects with the interior of the polygon. Note that this function doesn't do back-face culling.

bool iPolygon3D::IntersectRayPlane ( const csVector3 & start,
const csVector3 & end,
csVector3 & isect ) [pure virtual]
 

Intersect object space ray with the plane of this polygon and returns the intersection point.

This function does not test if the intersection is inside the polygon. It just returns the intersection with the plane (in or out). This function returns false if the ray is parallel with the plane (i.e. there is no intersection).

bool iPolygon3D::IntersectSegment ( const csVector3 & start,
const csVector3 & end,
csVector3 & isect,
float * pr = NULL ) [pure virtual]
 

Intersect object-space segment with this polygon.

Return true if it intersects and the intersection point in world coordinates.

bool iPolygon3D::PointOnPolygon ( const csVector3 & v ) [pure virtual]
 

This is a given point is on (or very nearly on) this polygon.

Test happens in object space.

void iPolygon3D::SetAlpha ( int iAlpha ) [pure virtual]
 

Set the alpha transparency value for this polygon.

Not all renderers support all possible values. 0, 25, 50, 75, and 100 will always work but other values may give only the closest possible to one of the above.

void iPolygon3D::SetTextureSpace ( csMatrix3 const & m,
csVector3 const & v ) [pure virtual]
 

The most general function.

With these you provide the matrix directly.

void iPolygon3D::SetTextureSpace ( const csVector3 & v_orig,
const csVector3 & v1,
float l1 ) [pure virtual]
 

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

The first vertex is seen as the origin and the second as the u-axis of the texture space coordinate system. The v-axis is calculated on the plane of the polygon and orthogonal to the given u-axis. The length of the u-axis and the v-axis is given as the 'len1' parameter.

For example, if 'len1' is equal to 2 this means that texture will be tiled exactly two times between vertex 'v_orig' and 'v1'.

I hope this explanation is clear since I can't seem to make it any clearer :-)

void iPolygon3D::SetTextureType ( int type ) [pure virtual]
 

Set type of texturing to use for this polygon (one of the POLYTXT_??? flags).

POLYTXT_LIGHTMAP is default. This function is guaranteed not to do anything if the type is already correct.

void iPolygon3D::UpdateVertexLighting ( iLight * light,
const csColor & lcol,
bool dynamic,
bool reset ) [pure virtual]
 

Update vertex lighting for this polygon.

Only works if the polygon uses gouraud shading or is flat-shaded. 'dynamic' is true for a dynamic light. 'reset' is true if the light values need to be reset to 0. 'lcol' is the color of the light. It is given seperately because the color of the light may be modified by portals and other effects.
'light' can be NULL in which case this function is useful for resetting dynamic light values to the static lights ('reset' must be equal to true then). @@ TEMPORARY FUNCTION: it is better to use the mesh object lighting system for this!


The documentation for this struct was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000