Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

polygon.h

00001 /*
00002     Copyright (C) 1998-2001 by Jorrit Tyberghein
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_POLYGON_H__
00020 #define __CS_POLYGON_H__
00021 
00022 #include "csutil/scf.h"
00023 #include "csutil/cscolor.h"
00024 #include "csutil/flags.h"
00025 #include "csgeom/transfrm.h"
00026 #include "csgeom/polyclip.h"
00027 #include "csgeom/polyidx.h"
00028 #include "csengine/polyint.h"
00029 #include "csengine/polyplan.h"
00030 #include "csengine/thing.h"
00031 #include "csengine/portal.h"
00032 #include "csengine/polytext.h"
00033 #include "csengine/octree.h"
00034 #include "csengine/material.h"
00035 #include "iengine/sector.h"
00036 #include "imesh/thing/polygon.h"
00037 #include "imesh/thing/ptextype.h"
00038 
00039 class csSector;
00040 class csFrustumView;
00041 class csFrustumContext;
00042 class csMaterialWrapper;
00043 class csPolyPlane;
00044 class csPolyTxtPlane;
00045 class csPolygon2D;
00046 class csPolygon3D;
00047 class csLightMap;
00048 class csLightPatch;
00049 class csPolyTexture;
00050 class csThing;
00051 struct iLight;
00052 struct iGraphics2D;
00053 struct iGraphics3D;
00054 struct iCacheManager;
00055 
00060 struct csPolygonLightInfo
00061 {
00068   float cosinus_factor;
00069 
00073   csLightPatch *lightpatches;
00074 
00078   bool dyn_dirty;
00079 };
00080 
00081 /*---------------------------------------------------------------------------*/
00082 
00089 class csPolyTexType : public iPolyTexType
00090 {
00091   friend class csPolygon3D;
00092 
00093 protected:
00100   uint16 Alpha;
00101 
00107   uint MixMode;
00108 
00110   csPolyTexType ();
00112   virtual ~csPolyTexType ();
00113 
00114 public:
00116   virtual int GetTextureType () { return POLYTXT_NONE; }
00117 
00119   int GetAlpha () { return Alpha; }
00121   void SetAlpha (int a) { Alpha = a; }
00122 
00124   virtual void SetMixMode (uint m) { MixMode = m & ~CS_FX_MASK_ALPHA; }
00125 
00127   virtual uint GetMixMode () { return (MixMode | Alpha); }
00128 
00129   SCF_DECLARE_IBASE;
00130 };
00131 
00137 class csPolyTexFlat : public csPolyTexType
00138 {
00139   friend class csPolygon3D;
00140 
00141 private:
00146   csVector2* uv_coords;
00147 
00148 protected:
00150   csPolyTexFlat () : csPolyTexType ()
00151   { SCF_CONSTRUCT_EMBEDDED_IBASE(scfiPolyTexFlat); uv_coords = NULL; }
00152 
00154   virtual ~csPolyTexFlat ();
00155 
00156 public:
00158   virtual int GetTextureType () { return POLYTXT_FLAT; }
00159 
00165   void Setup (csPolygon3D *iParent);
00166 
00172   virtual void Setup (iPolygon3D *iParent);
00173 
00185   virtual void SetUV (int i, float u, float v);
00186 
00190   virtual void ClearUV ();
00191 
00193   virtual csVector2 *GetUVCoords () { return uv_coords; }
00194 
00195   SCF_DECLARE_IBASE_EXT (csPolyTexType);
00196 
00197   struct eiPolyTexFlat : public iPolyTexFlat
00198   {
00199     SCF_DECLARE_EMBEDDED_IBASE(csPolyTexFlat);
00200     virtual void Setup (iPolygon3D *p) { scfParent->Setup(p); }
00201     virtual void SetUV (int i, float u, float v) { scfParent->SetUV(i,u,v); }
00202     virtual void ClearUV () { scfParent->ClearUV(); }
00203     virtual csVector2 *GetUVCoords () { return scfParent->GetUVCoords(); }
00204   } scfiPolyTexFlat;
00205 };
00206 
00211 class csPolyTexGouraud : public csPolyTexFlat
00212 {
00213   friend class csPolygon3D;
00214 
00215 private:
00221   csColor *colors;
00222 
00227   csColor *static_colors;
00228 
00234   bool gouraud_up_to_date;
00235 
00236 protected:
00238   csPolyTexGouraud () : csPolyTexFlat ()
00239   {
00240     SCF_CONSTRUCT_EMBEDDED_IBASE(scfiPolyTexGouraud);
00241     colors = static_colors = 0;
00242     gouraud_up_to_date = false;
00243   }
00244 
00246   virtual ~csPolyTexGouraud ();
00247 
00248 public:
00250   virtual int GetTextureType () { return POLYTXT_GOURAUD; }
00251 
00257   void Setup (csPolygon3D *iParent);
00258 
00264   virtual void Setup (iPolygon3D *iParent);
00265 
00269   virtual void ClearColors ();
00270 
00272   virtual csColor *GetColors () { return colors; }
00273 
00275   virtual csColor *GetStaticColors () { return static_colors; }
00276 
00280   void AddColor (int i, float r, float g, float b);
00281 
00285   void AddDynamicColor (int i, float r, float g, float b);
00286 
00290   void SetDynamicColor (int i, float r, float g, float b);
00291 
00295   virtual void ResetDynamicColor (int i);
00296 
00300   virtual void SetDynamicColor (int i, const csColor& c)
00301   { SetDynamicColor (i, c.red, c.green, c.blue); }
00302 
00306   void SetColor (int i, float r, float g, float b);
00307 
00311   virtual void SetColor (int i, const csColor& c)
00312   { SetColor (i, c.red, c.green, c.blue); }
00313 
00314   SCF_DECLARE_IBASE_EXT (csPolyTexFlat);
00315 
00316   struct eiPolyTexGouraud : public iPolyTexGouraud
00317   {
00318     SCF_DECLARE_EMBEDDED_IBASE(csPolyTexGouraud);
00319     virtual void Setup (iPolygon3D *p) { scfParent->Setup(p); }
00320     virtual void ClearColors () { scfParent->ClearColors(); }
00321     virtual csColor *GetColors () { return scfParent->GetColors(); }
00322     virtual csColor *GetStaticColors() { return scfParent->GetStaticColors(); }
00323     virtual void ResetDynamicColor (int i) { scfParent->ResetDynamicColor(i); }
00324     virtual void SetDynamicColor (int i, const csColor& c)
00325     { scfParent->SetDynamicColor(i,c); }
00326     virtual void SetColor(int i,const csColor& c) { scfParent->SetColor(i,c); }
00327   } scfiPolyTexGouraud;
00328 };
00329 
00334 class csPolyTexLightMap : public csPolyTexType
00335 {
00336   friend class csPolygon3D;
00337 
00338 private:
00340   csPolyTexture *tex;
00341 
00345   csPolyTxtPlane *txt_plane;
00346 
00351   bool lightmap_up_to_date;
00352 
00353 private:
00355   csPolyTexLightMap ();
00356 
00358   virtual ~csPolyTexLightMap ();
00359 
00360 public:
00362   void Setup (csPolygon3D* poly3d, csMaterialWrapper* math);
00363 
00365   virtual int GetTextureType () { return POLYTXT_LIGHTMAP; }
00366 
00368   csPolyTexture* GetPolyTex ();
00369 
00373   csPolyTxtPlane* GetTxtPlane () const { return txt_plane; }
00377   virtual iPolyTxtPlane* GetPolyTxtPlane () const;
00378 
00382   void SetTxtPlane (csPolyTxtPlane* txt_pl);
00383 
00387   void NewTxtPlane ();
00388 
00392   iLightMap* GetLightMap () { return tex->GetLightMap (); }
00393 
00394   SCF_DECLARE_IBASE_EXT (csPolyTexType);
00395 
00396   struct eiPolyTexLightMap : public iPolyTexLightMap
00397   {
00398     SCF_DECLARE_EMBEDDED_IBASE(csPolyTexLightMap);
00399     virtual iPolyTxtPlane* GetPolyTxtPlane () const
00400     { return scfParent->GetPolyTxtPlane(); }
00401   } scfiPolyTexLightMap;
00402 };
00403 
00404 /*---------------------------------------------------------------------------*/
00405 
00415 #define CS_POLY_DELETE_PORTAL   0x80000000
00416 
00424 #define CS_POLY_NO_DRAW         0x40000000
00425 
00431 #define CS_POLY_SPLIT           0x20000000
00432 
00438 #define CS_POLY_LM_REFUSED      0x10000000
00439 
00463 class csPolygon3D : public csPolygonInt, public csObject
00464 // NOTE: DO NOT MOVE csPolygonInt FROM FIRST PLACE! THERE ARE LOTS OF PLACES
00465 // WHERE CODE BLATANTLY SWITCHES BETWEEN csPolygon3D AND csPolygonInt TYPES
00466 // WITHOUT GIVING TO THE C++ COMPILER EVEN A CHANCE TO ADJUST THE POINTER!!!
00467 {
00468   friend class csPolyTexture;
00469 
00470 private:
00472   unsigned long polygon_id;
00473 
00474   /*
00475    * A table of indices into the vertices of the parent csThing
00476    * (container).
00477    */
00478   csPolyIndexed vertices;
00479 
00488   csThing* thing;
00489 
00498   csPortal* portal;
00499 
00503   csPolyPlane* plane;
00504 
00509   csMaterialWrapper* material;
00510 
00514   csPolygonLightInfo light_info;
00515 
00520   csPolyTexType *txt_info;
00521 
00528   csPolygon3D *orig_poly;
00529 
00537   csPolygon3D *txt_share_list;
00538 
00543   uint32 pvs_vis_nr;
00544 
00550   void PlaneNormal (float* yz, float* zx, float* xy);
00551 
00552 #ifdef DO_HW_UVZ
00553 
00554   void SetupHWUV();
00555 #endif
00556 
00562   void CalculateDelayedLighting (csFrustumView *lview, csFrustumContext* ctxt);
00563 
00564 public:
00566   csFlags flags;
00567 
00568 public:
00569 #ifdef DO_HW_UVZ
00570   csVector3 *uvz;
00571   bool isClipped;
00572 #endif
00573 
00577   csPolygon3D (csMaterialWrapper *mat);
00578 
00585   csPolygon3D (csPolygon3D& poly);
00586 
00592   virtual ~csPolygon3D ();
00593 
00595   unsigned long GetPolygonID ()
00596   {
00597     CS_ASSERT (polygon_id != 0);
00598     return polygon_id;
00599   }
00600 
00607   void SetTextureType (int type);
00608 
00612   int GetTextureType ()
00613   { return txt_info->GetTextureType (); }
00614 
00620   void CopyTextureType (iPolygon3D* other_polygon);
00621 
00625   csPolyTexType *GetTextureTypeInfo () { return txt_info; }
00626 
00631   csPolyTexLightMap *GetLightMapInfo ()
00632   {
00633     if (txt_info && txt_info->GetTextureType () == POLYTXT_LIGHTMAP)
00634       return (csPolyTexLightMap *)txt_info;
00635     else
00636       return NULL;
00637   }
00638 
00643   csPolyTexGouraud *GetGouraudInfo ()
00644   {
00645     if (txt_info && txt_info->GetTextureType () == POLYTXT_GOURAUD)
00646       return (csPolyTexGouraud*)txt_info;
00647     else
00648       return NULL;
00649   }
00650 
00656   csPolyTexFlat *GetFlatInfo ()
00657   {
00658     if (txt_info
00659      && (txt_info->GetTextureType () == POLYTXT_FLAT
00660       || txt_info->GetTextureType () == POLYTXT_GOURAUD))
00661       return (csPolyTexFlat*)txt_info;
00662     else
00663       return NULL;
00664   }
00665 
00672   csPolyTexType *GetNoTexInfo ()
00673   {
00674     if (txt_info && txt_info->GetTextureType () != POLYTXT_LIGHTMAP)
00675       return (csPolyTexType *)txt_info;
00676     else
00677       return NULL;
00678   }
00679 
00683   void Reset ();
00684 
00688   int AddVertex (int v);
00689 
00697   int AddVertex (const csVector3& v);
00698 
00706   int AddVertex (float x, float y, float z);
00707 
00713   void ComputeNormal ();
00714 
00725   void Finish ();
00726 
00734   void SetCSPortal (csSector* sector, bool null = false);
00735 
00739   void SetPortal (csPortal* prt);
00740 
00744   csPortal* GetPortal () { return portal; }
00745 
00749   void SetParent (csThing* thing);
00750 
00754   csThing* GetParent () { return thing; }
00755 
00761   csPolyPlane* GetPlane () { return plane; }
00762 
00766   csPlane3* GetPolyPlane () { return &plane->GetWorldPlane (); }
00767 
00771   csPolyIndexed& GetVertices () { return vertices; }
00772 
00776   virtual int GetVertexCount () { return vertices.GetVertexCount (); }
00777 
00781   virtual int* GetVertexIndices () { return vertices.GetVertexIndices (); }
00782 
00787   void SetWarp (const csTransform& t) { if (portal) portal->SetWarp (t); }
00788 
00793   void SetWarp (const csMatrix3& m_w, const csVector3& v_w_before,
00794         const csVector3& v_w_after)
00795   {
00796     if (portal) portal->SetWarp (m_w, v_w_before, v_w_after);
00797   }
00798 
00804   const csVector3& Vwor (int idx) const
00805   { return thing->Vwor (vertices.GetVertexIndices ()[idx]); }
00806 
00812   const csVector3& Vobj (int idx) const
00813   { return thing->Vobj (vertices.GetVertexIndices ()[idx]); }
00814 
00820   const csVector3& Vcam (int idx) const
00821   { return thing->Vcam (vertices.GetVertexIndices ()[idx]); }
00822 
00828   void UpdateTransformation (const csTransform& c, long cam_cameranr)
00829   {
00830     thing->UpdateTransformation (c, cam_cameranr);
00831   }
00832 
00838   void WorUpdate () { thing->WorUpdate (); }
00839 
00847   void SetMaterial (csMaterialWrapper* material);
00848 
00852   csMaterialWrapper* GetMaterialWrapper () { return material; }
00853 
00857   bool IsTransparent ();
00858 
00860   float GetArea ();
00861 
00866   float GetCosinusFactor () { return light_info.cosinus_factor; }
00867 
00872   void SetCosinusFactor (float f) { light_info.cosinus_factor = f; }
00873 
00892   void SetTextureSpace (csPolygon3D* copy_from);
00893 
00899   void SetTextureSpace (csPolyTxtPlane* txt_pl);
00900 
00905   void SetTextureSpace (
00906         const csVector3& p1, const csVector2& uv1,
00907         const csVector3& p2, const csVector2& uv2,
00908         const csVector3& p3, const csVector2& uv3);
00909 
00925   void SetTextureSpace (const csVector3& v_orig,
00926     const csVector3& v1, float len1);
00927 
00937   void SetTextureSpace (
00938     float xo, float yo, float zo,
00939     float x1, float y1, float z1, float len1);
00940 
00945   void SetTextureSpace (
00946     const csVector3& v_orig,
00947     const csVector3& v1, float len1,
00948     const csVector3& v2, float len2);
00949 
00953   void SetTextureSpace (
00954     float xo, float yo, float zo,
00955     float x1, float y1, float z1, float len1,
00956     float x2, float y2, float z2, float len2);
00957 
00962   void SetTextureSpace (csMatrix3 const&, csVector3 const&);
00963 
00965   csPolygonInt* GetUnsplitPolygon () { return orig_poly; }
00966 
00971   csPolygon3D* GetBasePolygon ()
00972   { return orig_poly ? (csPolygon3D*)orig_poly : this; }
00973 
00979   void MakeDirtyDynamicLights ();
00980 
00982   bool IsDirty () { return light_info.dyn_dirty; }
00983 
00985   void MakeCleanDynamicLights () { light_info.dyn_dirty = false; }
00986 
00992   void UnlinkLightpatch (csLightPatch* lp);
00993 
00997   void AddLightpatch (csLightPatch *lp);
00998 
01002   csLightPatch* GetLightpatches () { return light_info.lightpatches; }
01003 
01009   void ClipPolyPlane (csVector3* verts, int* num, bool mirror,
01010         csVector3& v1, csVector3& v2);
01011 
01017   void InitializeDefault ();
01018 
01025   bool ReadFromCache (iCacheManager* cache_mgr, int id);
01026 
01032   bool WriteToCache (iCacheManager* cache_mgr, int id);
01033 
01041   void PrepareLighting ();
01042 
01054   void FillLightMapDynamic (csFrustumView& lview);
01055 
01071   void FillLightMapStatic (csFrustumView* lview, bool vis);
01072 
01085   void UpdateVertexLighting (iLight* light, const csColor& lcol,
01086         bool dynamic, bool reset);
01087 
01099   bool MarkRelevantShadowFrustums (csFrustumView& lview, csPlane3& plane);
01100 
01104   bool MarkRelevantShadowFrustums (csFrustumView& lview);
01105 
01112   void CalculateLightingDynamic (csFrustumView* lview);
01113 
01122   void CalculateLightingStatic (csFrustumView* lview, bool vis);
01123 
01128   void ObjectToWorld (const csReversibleTransform& t, const csVector3& vwor);
01129 
01136   void HardTransform (const csReversibleTransform& t);
01137 
01152   bool ClipToPlane (csPlane3* portal_plane, const csVector3& v_w2c,
01153         csVector3*& pverts, int& num_verts, bool cw = true);
01154 
01167   bool DoPerspective (const csTransform& trans, csVector3* source,
01168         int num_verts, csPolygon2D* dest, csVector2* orig_triangle,
01169         bool mirror);
01170 
01178   virtual int Classify (const csPlane3& pl);
01179 
01181   virtual int ClassifyX (float x);
01182 
01184   virtual int ClassifyY (float y);
01185 
01187   virtual int ClassifyZ (float z);
01188 
01196   virtual void SplitWithPlane (csPolygonInt** front, csPolygonInt** back,
01197         const csPlane3& plane);
01198 
01203   virtual bool Overlaps (csPolygonInt* overlapped);
01204 
01209   virtual int GetType () { return 1; }
01210 
01215   bool IntersectSegment (const csVector3& start, const csVector3& end,
01216                           csVector3& isect, float* pr = NULL);
01217 
01225   bool IntersectRay (const csVector3& start, const csVector3& end);
01226 
01234   bool IntersectRayNoBackFace (const csVector3& start, const csVector3& end);
01235 
01243   bool IntersectRayPlane (const csVector3& start, const csVector3& end,
01244         csVector3& isect);
01245 
01250   bool PointOnPolygon (const csVector3& v);
01251 
01253   virtual int GetAlpha ()
01254   { return txt_info->GetAlpha (); }
01255 
01263   virtual void SetAlpha (int iAlpha)
01264   { txt_info->SetAlpha (iAlpha); }
01265 
01267   virtual iMaterialHandle *GetMaterialHandle ();
01269   virtual iPolygonTexture *GetTexture ()
01270   {
01271     csPolyTexLightMap *lm = GetLightMapInfo ();
01272     return lm ? lm->GetPolyTex () : (iPolygonTexture*)NULL;
01273   }
01274 
01276   csPolygon3D *GetNextShare ()
01277   { return txt_share_list; }
01279   void SetNextShare (csPolygon3D *next)
01280   { txt_share_list = next; }
01281 
01282   SCF_DECLARE_IBASE_EXT (csObject);
01283 
01284   //------------------- iPolygon3D interface implementation -------------------
01285 
01286   struct eiPolygon3D : public iPolygon3D
01287   {
01288     SCF_DECLARE_EMBEDDED_IBASE (csPolygon3D);
01289 
01290     virtual csPolygon3D *GetPrivateObject () { return scfParent; }
01291     virtual iObject *QueryObject() {return scfParent;}
01292     virtual iThingState *GetParent ();
01293     virtual iLightMap *GetLightMap ()
01294     {
01295       csPolyTexLightMap *lm = scfParent->GetLightMapInfo ();
01296       return lm ? lm->GetLightMap () : (iLightMap*)NULL;
01297     }
01298     virtual iPolygonTexture *GetTexture () { return scfParent->GetTexture(); }
01299     virtual iMaterialHandle *GetMaterialHandle ()
01300     { return scfParent->GetMaterialHandle (); }
01301     virtual void SetMaterial (iMaterialWrapper* mat)
01302     {
01303       scfParent->SetMaterial (
01304         ((csMaterialWrapper::MaterialWrapper*)(mat))->scfParent);
01305     }
01306     virtual iMaterialWrapper* GetMaterial ()
01307     {
01308       // @@@ Not efficient. In future we need to store iMaterialWrapper
01309       // directly.
01310       if (!scfParent->GetMaterialWrapper ()) return NULL;
01311       else
01312       {
01313         iMaterialWrapper* wrap = SCF_QUERY_INTERFACE (
01314           scfParent->GetMaterialWrapper (), iMaterialWrapper);
01315         wrap->DecRef ();
01316         return wrap;
01317       }
01318     }
01319 
01320     virtual int GetVertexCount ()
01321     { return scfParent->vertices.GetVertexCount (); }
01322     virtual int* GetVertexIndices ()
01323     { return scfParent->vertices.GetVertexIndices (); }
01324     virtual const csVector3 &GetVertex (int idx) const
01325     { return scfParent->Vobj (idx); }
01326     virtual const csVector3 &GetVertexW (int idx) const
01327     { return scfParent->Vwor (idx); }
01328     virtual const csVector3 &GetVertexC (int idx) const
01329     { return scfParent->Vcam (idx); }
01330     virtual int CreateVertex (int idx)
01331     { return scfParent->AddVertex (idx); }
01332     virtual int CreateVertex (const csVector3 &iVertex)
01333     { return scfParent->AddVertex (iVertex); }
01334 
01335     virtual int GetAlpha ()
01336     { return scfParent->GetAlpha (); }
01337     virtual void SetAlpha (int iAlpha)
01338     { scfParent->SetAlpha (iAlpha); }
01339 
01340     virtual void CreatePlane (const csVector3 &iOrigin,
01341       const csMatrix3 &iMatrix);
01342     virtual bool SetPlane (const char *iName);
01343 
01344     virtual csFlags& GetFlags ()
01345     { return scfParent->flags; }
01346 
01347     virtual void SetLightingMode (bool iGouraud)
01348     { scfParent->SetTextureType(iGouraud ? POLYTXT_GOURAUD:POLYTXT_LIGHTMAP); }
01349 
01350     virtual iPortal* CreateNullPortal ()
01351     {
01352       scfParent->SetCSPortal (NULL, true);
01353       return &(scfParent->GetPortal ()->scfiPortal);
01354     }
01355     virtual iPortal* CreatePortal (iSector *iTarget)
01356     {
01357       scfParent->SetCSPortal (iTarget->GetPrivateObject ());
01358       return &(scfParent->GetPortal ()->scfiPortal);
01359     }
01360     virtual iPortal* GetPortal ()
01361     {
01362       csPortal* prt = scfParent->GetPortal ();
01363       if (prt)
01364         return &(prt->scfiPortal);
01365       else
01366         return NULL;
01367     }
01368 
01369     virtual void SetTextureSpace (
01370         const csVector3& p1, const csVector2& uv1,
01371         const csVector3& p2, const csVector2& uv2,
01372         const csVector3& p3, const csVector2& uv3)
01373     {
01374       scfParent->SetTextureSpace (p1, uv1, p2, uv2, p3, uv3);
01375     }
01376     virtual void SetTextureSpace (const csVector3& v_orig,
01377       const csVector3& v1, float l1)
01378     {
01379       scfParent->SetTextureSpace (v_orig, v1, l1);
01380     }
01381     virtual void SetTextureSpace (
01382         const csVector3& v_orig,
01383         const csVector3& v1, float len1,
01384         const csVector3& v2, float len2)
01385     {
01386       scfParent->SetTextureSpace (v_orig, v1, len1, v2, len2);
01387     }
01388     virtual void SetTextureSpace (csMatrix3 const& m, csVector3 const& v)
01389     {
01390       scfParent->SetTextureSpace (m, v);
01391     }
01392     virtual void SetTextureSpace (iPolyTxtPlane* plane);
01393 
01394     virtual void SetTextureType (int type)
01395     {
01396       scfParent->SetTextureType (type);
01397     }
01398     virtual int GetTextureType ()
01399     {
01400       return scfParent->GetTextureType ();
01401     }
01402     virtual void CopyTextureType (iPolygon3D* other_polygon)
01403     {
01404       scfParent->CopyTextureType (other_polygon);
01405     }
01406 
01407     virtual const csPlane3& GetWorldPlane ()
01408     {
01409       return scfParent->plane->GetWorldPlane ();
01410     }
01411     virtual const csPlane3& GetObjectPlane ()
01412     {
01413       return scfParent->plane->GetObjectPlane ();
01414     }
01415     virtual const csPlane3& GetCameraPlane ()
01416     {
01417       return scfParent->plane->GetCameraPlane ();
01418     }
01419     virtual bool IsTransparent ()
01420     {
01421       return scfParent->IsTransparent ();
01422     }
01423     virtual float GetCosinusFactor ()
01424     {
01425       return scfParent->GetCosinusFactor ();
01426     }
01427     virtual void SetCosinusFactor (float cosfact)
01428     {
01429       scfParent->SetCosinusFactor (cosfact);
01430     }
01431     virtual iPolyTexType* GetPolyTexType ();
01432     virtual void UpdateVertexLighting (iLight* light, const csColor& lcol,
01433         bool dynamic, bool reset)
01434     {
01435       scfParent->UpdateVertexLighting (light, lcol, dynamic, reset);
01436     }
01437     virtual unsigned long GetPolygonID ()
01438     {
01439       return scfParent->GetPolygonID ();
01440     }
01441     virtual bool IntersectSegment (const csVector3& start, const csVector3& end,
01442                           csVector3& isect, float* pr = NULL)
01443     {
01444       return scfParent->IntersectSegment (start, end, isect, pr);
01445     }
01446     virtual bool IntersectRay (const csVector3& start, const csVector3& end)
01447     {
01448       return scfParent->IntersectRay (start, end);
01449     }
01450     virtual bool IntersectRayNoBackFace (const csVector3& start,
01451       const csVector3& end)
01452     {
01453       return scfParent->IntersectRayNoBackFace (start, end);
01454     }
01455     virtual bool IntersectRayPlane (const csVector3& start,
01456       const csVector3& end, csVector3& isect)
01457     {
01458       return scfParent->IntersectRayPlane (start, end, isect);
01459     }
01460     virtual bool PointOnPolygon (const csVector3& v)
01461     {
01462       return scfParent->PointOnPolygon (v);
01463     }
01464   } scfiPolygon3D;
01465   friend struct eiPolygon3D;
01466 };
01467 
01468 #endif // __CS_POLYGON_H__

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000