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 
00059 struct csPolygonLightInfo
00060 {
00067   float cosinus_factor;
00068 
00072   csLightPatch *lightpatches;
00073 
00077   bool dyn_dirty;
00078 };
00079 
00080 /*---------------------------------------------------------------------------*/
00081 
00088 class csPolyTexType : public iPolyTexType
00089 {
00090   friend class csPolygon3D;
00091 
00092 protected:
00099   ushort Alpha;
00100 
00106   uint MixMode;
00107 
00109   csPolyTexType ();
00111   virtual ~csPolyTexType ();
00112 
00113 public:
00115   virtual int GetTextureType () { return POLYTXT_NONE; }
00116 
00118   int GetAlpha () { return Alpha; }
00120   void SetAlpha (int a) { Alpha = a; }
00121 
00123   virtual void SetMixMode (UInt m) { MixMode = m & ~CS_FX_MASK_ALPHA; }
00124 
00126   virtual UInt GetMixMode () { return (MixMode | Alpha); }
00127 
00128   SCF_DECLARE_IBASE;
00129 };
00130 
00136 class csPolyTexFlat : public csPolyTexType
00137 {
00138   friend class csPolygon3D;
00139 
00140 private:
00145   csVector2* uv_coords;
00146 
00147 protected:
00149   csPolyTexFlat () : csPolyTexType ()
00150   { SCF_CONSTRUCT_EMBEDDED_IBASE(scfiPolyTexFlat); uv_coords = NULL; }
00151 
00153   virtual ~csPolyTexFlat ();
00154 
00155 public:
00157   virtual int GetTextureType () { return POLYTXT_FLAT; }
00158 
00164   void Setup (csPolygon3D *iParent);
00165 
00171   virtual void Setup (iPolygon3D *iParent);
00172 
00184   virtual void SetUV (int i, float u, float v);
00185 
00189   virtual void ClearUV ();
00190 
00192   virtual csVector2 *GetUVCoords () { return uv_coords; }
00193 
00194   SCF_DECLARE_IBASE_EXT (csPolyTexType);
00195 
00196   struct eiPolyTexFlat : public iPolyTexFlat
00197   {
00198     SCF_DECLARE_EMBEDDED_IBASE(csPolyTexFlat);
00199     virtual void Setup (iPolygon3D *p) { scfParent->Setup(p); }
00200     virtual void SetUV (int i, float u, float v) { scfParent->SetUV(i,u,v); }
00201     virtual void ClearUV () { scfParent->ClearUV(); }
00202     virtual csVector2 *GetUVCoords () { return scfParent->GetUVCoords(); }
00203   } scfiPolyTexFlat;
00204 };
00205 
00210 class csPolyTexGouraud : public csPolyTexFlat
00211 {
00212   friend class csPolygon3D;
00213 
00214 private:
00220   csColor *colors;
00221 
00226   csColor *static_colors;
00227 
00228 protected:
00230   csPolyTexGouraud () : csPolyTexFlat ()
00231   { SCF_CONSTRUCT_EMBEDDED_IBASE(scfiPolyTexGouraud); colors = static_colors = 0; }
00232 
00234   virtual ~csPolyTexGouraud ();
00235 
00236 public:
00238   virtual int GetTextureType () { return POLYTXT_GOURAUD; }
00239 
00245   void Setup (csPolygon3D *iParent);
00246 
00252   virtual void Setup (iPolygon3D *iParent);
00253 
00257   virtual void ClearColors ();
00258 
00260   virtual csColor *GetColors () { return colors; }
00261 
00263   virtual csColor *GetStaticColors () { return static_colors; }
00264 
00268   void AddColor (int i, float r, float g, float b);
00269 
00273   void AddDynamicColor (int i, float r, float g, float b);
00274 
00278   void SetDynamicColor (int i, float r, float g, float b);
00279 
00283   virtual void ResetDynamicColor (int i);
00284 
00288   virtual void SetDynamicColor (int i, const csColor& c)
00289   { SetDynamicColor (i, c.red, c.green, c.blue); }
00290 
00294   void SetColor (int i, float r, float g, float b);
00295 
00299   virtual void SetColor (int i, const csColor& c)
00300   { SetColor (i, c.red, c.green, c.blue); }
00301 
00302   SCF_DECLARE_IBASE_EXT (csPolyTexFlat);
00303 
00304   struct eiPolyTexGouraud : public iPolyTexGouraud
00305   {
00306     SCF_DECLARE_EMBEDDED_IBASE(csPolyTexGouraud);
00307     virtual void Setup (iPolygon3D *p) { scfParent->Setup(p); }
00308     virtual void ClearColors () { scfParent->ClearColors(); }
00309     virtual csColor *GetColors () { return scfParent->GetColors(); }
00310     virtual csColor *GetStaticColors() { return scfParent->GetStaticColors(); }
00311     virtual void ResetDynamicColor (int i) { scfParent->ResetDynamicColor(i); }
00312     virtual void SetDynamicColor (int i, const csColor& c)
00313     { scfParent->SetDynamicColor(i,c); }
00314     virtual void SetColor(int i,const csColor& c) { scfParent->SetColor(i,c); }
00315   } scfiPolyTexGouraud;
00316 };
00317 
00322 class csPolyTexLightMap : public csPolyTexType
00323 {
00324   friend class csPolygon3D;
00325 
00326 private:
00328   csPolyTexture *tex;
00329 
00333   csPolyTxtPlane *txt_plane;
00334 
00339   bool lightmap_up_to_date;
00340 
00341 private:
00343   csPolyTexLightMap ();
00344 
00346   virtual ~csPolyTexLightMap ();
00347 
00348 public:
00350   void Setup (csPolygon3D* poly3d, csMaterialWrapper* math);
00351 
00353   virtual int GetTextureType () { return POLYTXT_LIGHTMAP; }
00354 
00356   csPolyTexture* GetPolyTex ();
00357 
00361   csPolyTxtPlane* GetTxtPlane () const { return txt_plane; }
00365   virtual iPolyTxtPlane* GetPolyTxtPlane () const;
00366 
00370   void SetTxtPlane (csPolyTxtPlane* txt_pl);
00371 
00375   void NewTxtPlane ();
00376 
00380   iLightMap* GetLightMap () { return tex->GetLightMap (); }
00381 
00382   SCF_DECLARE_IBASE_EXT (csPolyTexType);
00383 
00384   struct eiPolyTexLightMap : public iPolyTexLightMap
00385   {
00386     SCF_DECLARE_EMBEDDED_IBASE(csPolyTexLightMap);
00387     virtual iPolyTxtPlane* GetPolyTxtPlane () const
00388     { return scfParent->GetPolyTxtPlane(); }
00389   } scfiPolyTexLightMap;
00390 };
00391 
00392 /*---------------------------------------------------------------------------*/
00393 
00403 #define CS_POLY_DELETE_PORTAL   0x80000000
00404 
00412 #define CS_POLY_NO_DRAW         0x40000000
00413 
00419 #define CS_POLY_SPLIT           0x20000000
00420 
00444 class csPolygon3D : public csPolygonInt, public csObject
00445 // NOTE: DO NOT MOVE csPolygonInt FROM FIRST PLACE! THERE ARE LOTS OF PLACES
00446 // WHERE CODE BLATANTLY SWITCHES BETWEEN csPolygon3D AND csPolygonInt TYPES
00447 // WITHOUT GIVING TO THE C++ COMPILER EVEN A CHANCE TO ADJUST THE POINTER!!!
00448 {
00449   friend class csPolyTexture;
00450 
00451 private:
00453   unsigned long polygon_id;
00454 
00455   /*
00456    * A table of indices into the vertices of the parent csThing
00457    * (container).
00458    */
00459   csPolyIndexed vertices;
00460 
00469   csThing* thing;
00470 
00479   csPortal* portal;
00480 
00484   csPolyPlane* plane;
00485 
00490   csMaterialWrapper* material;
00491 
00495   csPolygonLightInfo light_info;
00496 
00501   csPolyTexType *txt_info;
00502 
00509   csPolygon3D *orig_poly;
00510 
00518   csPolygon3D *txt_share_list;
00519 
00524   ULong pvs_vis_nr;
00525 
00531   void PlaneNormal (float* yz, float* zx, float* xy);
00532 
00533 #ifdef DO_HW_UVZ
00534 
00535   void SetupHWUV();
00536 #endif
00537   
00543   void CalculateDelayedLighting (csFrustumView *lview, csFrustumContext* ctxt);
00544 
00545 public:
00547   csFlags flags;
00548 
00549 public:
00550 #ifdef DO_HW_UVZ
00551   csVector3 *uvz;
00552   bool isClipped;
00553 #endif
00554 
00558   csPolygon3D (csMaterialWrapper *mat);
00559 
00566   csPolygon3D (csPolygon3D& poly);
00567 
00573   virtual ~csPolygon3D ();
00574 
00576   unsigned long GetPolygonID ()
00577   {
00578     CS_ASSERT (polygon_id != 0);
00579     return polygon_id;
00580   }
00581 
00588   void SetTextureType (int type);
00589 
00593   int GetTextureType ()
00594   { return txt_info->GetTextureType (); }
00595 
00601   void CopyTextureType (iPolygon3D* other_polygon);
00602 
00606   csPolyTexType *GetTextureTypeInfo () { return txt_info; }
00607 
00612   csPolyTexLightMap *GetLightMapInfo ()
00613   {
00614     if (txt_info && txt_info->GetTextureType () == POLYTXT_LIGHTMAP)
00615       return (csPolyTexLightMap *)txt_info;
00616     else
00617       return NULL;
00618   }
00619 
00624   csPolyTexGouraud *GetGouraudInfo ()
00625   {
00626     if (txt_info && txt_info->GetTextureType () == POLYTXT_GOURAUD)
00627       return (csPolyTexGouraud*)txt_info;
00628     else
00629       return NULL;
00630   }
00631 
00637   csPolyTexFlat *GetFlatInfo ()
00638   {
00639     if (txt_info
00640      && (txt_info->GetTextureType () == POLYTXT_FLAT
00641       || txt_info->GetTextureType () == POLYTXT_GOURAUD))
00642       return (csPolyTexFlat*)txt_info;
00643     else
00644       return NULL;
00645   }
00646 
00653   csPolyTexType *GetNoTexInfo ()
00654   {
00655     if (txt_info && txt_info->GetTextureType () != POLYTXT_LIGHTMAP)
00656       return (csPolyTexType *)txt_info;
00657     else
00658       return NULL;
00659   }
00660 
00664   void Reset ();
00665 
00669   int AddVertex (int v);
00670 
00678   int AddVertex (const csVector3& v);
00679 
00687   int AddVertex (float x, float y, float z);
00688 
00694   void ComputeNormal ();
00695 
00706   void Finish ();
00707 
00715   void SetCSPortal (csSector* sector, bool null = false);
00716 
00720   void SetPortal (csPortal* prt);
00721 
00725   csPortal* GetPortal () { return portal; }
00726 
00730   void SetParent (csThing* thing);
00731 
00735   csThing* GetParent () { return thing; }
00736 
00742   csPolyPlane* GetPlane () { return plane; }
00743 
00747   csPlane3* GetPolyPlane () { return &plane->GetWorldPlane (); }
00748 
00752   csPolyIndexed& GetVertices () { return vertices; }
00753 
00757   virtual int GetVertexCount () { return vertices.GetVertexCount (); }
00758 
00762   virtual int* GetVertexIndices () { return vertices.GetVertexIndices (); }
00763 
00768   void SetWarp (const csTransform& t) { if (portal) portal->SetWarp (t); }
00769 
00774   void SetWarp (const csMatrix3& m_w, const csVector3& v_w_before,
00775         const csVector3& v_w_after)
00776   {
00777     if (portal) portal->SetWarp (m_w, v_w_before, v_w_after);
00778   }
00779 
00785   const csVector3& Vwor (int idx) const
00786   { return thing->Vwor (vertices.GetVertexIndices ()[idx]); }
00787 
00793   const csVector3& Vobj (int idx) const
00794   { return thing->Vobj (vertices.GetVertexIndices ()[idx]); }
00795 
00801   const csVector3& Vcam (int idx) const
00802   { return thing->Vcam (vertices.GetVertexIndices ()[idx]); }
00803 
00809   void UpdateTransformation (const csTransform& c, long cam_cameranr)
00810   {
00811     thing->UpdateTransformation (c, cam_cameranr);
00812   }
00813 
00819   void WorUpdate () { thing->WorUpdate (); }
00820 
00828   void SetMaterial (csMaterialWrapper* material);
00829 
00833   csMaterialWrapper* GetMaterialWrapper () { return material; }
00834 
00838   bool IsTransparent ();
00839 
00841   float GetArea ();
00842 
00847   float GetCosinusFactor () { return light_info.cosinus_factor; }
00848 
00853   void SetCosinusFactor (float f) { light_info.cosinus_factor = f; }
00854 
00873   void SetTextureSpace (csPolygon3D* copy_from);
00874 
00880   void SetTextureSpace (csPolyTxtPlane* txt_pl);
00881 
00886   void SetTextureSpace (
00887         const csVector3& p1, const csVector2& uv1,
00888         const csVector3& p2, const csVector2& uv2,
00889         const csVector3& p3, const csVector2& uv3);
00890 
00906   void SetTextureSpace (const csVector3& v_orig, 
00907     const csVector3& v1, float len1);
00908 
00918   void SetTextureSpace (
00919     float xo, float yo, float zo,
00920     float x1, float y1, float z1, float len1);
00921 
00926   void SetTextureSpace (
00927     const csVector3& v_orig,
00928     const csVector3& v1, float len1,
00929     const csVector3& v2, float len2);
00930 
00934   void SetTextureSpace (
00935     float xo, float yo, float zo,
00936     float x1, float y1, float z1, float len1,
00937     float x2, float y2, float z2, float len2);
00938 
00943   void SetTextureSpace (csMatrix3 const&, csVector3 const&);
00944 
00946   csPolygonInt* GetUnsplitPolygon () { return orig_poly; }
00947 
00952   csPolygon3D* GetBasePolygon ()
00953   { return orig_poly ? (csPolygon3D*)orig_poly : this; }
00954 
00960   void MakeDirtyDynamicLights ();
00961 
00963   bool IsDirty () { return light_info.dyn_dirty; }
00964 
00966   void MakeCleanDynamicLights () { light_info.dyn_dirty = false; }
00967 
00973   void UnlinkLightpatch (csLightPatch* lp);
00974 
00978   void AddLightpatch (csLightPatch *lp);
00979 
00983   csLightPatch* GetLightpatches () { return light_info.lightpatches; }
00984 
00990   void ClipPolyPlane (csVector3* verts, int* num, bool mirror,
00991         csVector3& v1, csVector3& v2);
00992 
00998   void InitializeDefault ();
00999 
01006   bool ReadFromCache (int id);
01007 
01013   bool WriteToCache (int id);
01014 
01022   void PrepareLighting ();
01023 
01035   void FillLightMapDynamic (csFrustumView& lview);
01036 
01052   void FillLightMapStatic (csFrustumView* lview, bool vis);
01053 
01066   void UpdateVertexLighting (iLight* light, const csColor& lcol,
01067         bool dynamic, bool reset);
01068 
01080   bool MarkRelevantShadowFrustums (csFrustumView& lview, csPlane3& plane);
01081 
01085   bool MarkRelevantShadowFrustums (csFrustumView& lview);
01086 
01093   void CalculateLightingDynamic (csFrustumView* lview);
01094 
01103   void CalculateLightingStatic (csFrustumView* lview, bool vis);
01104 
01109   void ObjectToWorld (const csReversibleTransform& t, const csVector3& vwor);
01110 
01117   void HardTransform (const csReversibleTransform& t);
01118 
01133   bool ClipToPlane (csPlane3* portal_plane, const csVector3& v_w2c,
01134         csVector3*& pverts, int& num_verts, bool cw = true);
01135 
01148   bool DoPerspective (const csTransform& trans, csVector3* source,
01149         int num_verts, csPolygon2D* dest, csVector2* orig_triangle,
01150         bool mirror);
01151 
01159   virtual int Classify (const csPlane3& pl);
01160 
01162   virtual int ClassifyX (float x);
01163 
01165   virtual int ClassifyY (float y);
01166 
01168   virtual int ClassifyZ (float z);
01169 
01177   virtual void SplitWithPlane (csPolygonInt** front, csPolygonInt** back,
01178         const csPlane3& plane);
01179 
01184   virtual bool Overlaps (csPolygonInt* overlapped);
01185 
01190   virtual int GetType () { return 1; }
01191 
01196   bool IntersectSegment (const csVector3& start, const csVector3& end,
01197                           csVector3& isect, float* pr = NULL);
01198 
01206   bool IntersectRay (const csVector3& start, const csVector3& end);
01207 
01215   bool IntersectRayNoBackFace (const csVector3& start, const csVector3& end);
01216 
01224   bool IntersectRayPlane (const csVector3& start, const csVector3& end,
01225         csVector3& isect);
01226 
01231   bool PointOnPolygon (const csVector3& v);
01232 
01234   virtual int GetAlpha ()
01235   { return txt_info->GetAlpha (); }
01236 
01244   virtual void SetAlpha (int iAlpha)
01245   { txt_info->SetAlpha (iAlpha); }
01246 
01248   virtual iMaterialHandle *GetMaterialHandle ();
01250   virtual iPolygonTexture *GetTexture ()
01251   {
01252     csPolyTexLightMap *lm = GetLightMapInfo ();
01253     return lm ? lm->GetPolyTex () : (iPolygonTexture*)NULL;
01254   }
01255 
01257   csPolygon3D *GetNextShare ()
01258   { return txt_share_list; }
01260   void SetNextShare (csPolygon3D *next)
01261   { txt_share_list = next; }
01262 
01263   SCF_DECLARE_IBASE_EXT (csObject);
01264 
01265   //------------------- iPolygon3D interface implementation -------------------
01266 
01267   struct eiPolygon3D : public iPolygon3D
01268   {
01269     SCF_DECLARE_EMBEDDED_IBASE (csPolygon3D);
01270 
01271     virtual csPolygon3D *GetPrivateObject () { return scfParent; }
01272     virtual iObject *QueryObject() {return scfParent;}
01273     virtual iThingState *GetParent ();
01274     virtual iLightMap *GetLightMap ()
01275     {
01276       csPolyTexLightMap *lm = scfParent->GetLightMapInfo ();
01277       return lm ? lm->GetLightMap () : (iLightMap*)NULL;
01278     }
01279     virtual iPolygonTexture *GetTexture () { return scfParent->GetTexture(); }
01280     virtual iMaterialHandle *GetMaterialHandle ()
01281     { return scfParent->GetMaterialHandle (); }
01282     virtual void SetMaterial (iMaterialWrapper* mat)
01283     {
01284       scfParent->SetMaterial (
01285         ((csMaterialWrapper::MaterialWrapper*)(mat))->scfParent);
01286     }
01287     virtual iMaterialWrapper* GetMaterial ()
01288     {
01289       // @@@ Not efficient. In future we need to store iMaterialWrapper
01290       // directly.
01291       if (!scfParent->GetMaterialWrapper ()) return NULL;
01292       else
01293       {
01294         iMaterialWrapper* wrap = SCF_QUERY_INTERFACE (
01295           scfParent->GetMaterialWrapper (), iMaterialWrapper);
01296         wrap->DecRef ();
01297         return wrap;
01298       }
01299     }
01300 
01301     virtual int GetVertexCount ()
01302     { return scfParent->vertices.GetVertexCount (); }
01303     virtual int* GetVertexIndices ()
01304     { return scfParent->vertices.GetVertexIndices (); }
01305     virtual const csVector3 &GetVertex (int idx) const
01306     { return scfParent->Vobj (idx); }
01307     virtual const csVector3 &GetVertexW (int idx) const
01308     { return scfParent->Vwor (idx); }
01309     virtual const csVector3 &GetVertexC (int idx) const
01310     { return scfParent->Vcam (idx); }
01311     virtual int CreateVertex (int idx)
01312     { return scfParent->AddVertex (idx); }
01313     virtual int CreateVertex (const csVector3 &iVertex)
01314     { return scfParent->AddVertex (iVertex); }
01315 
01316     virtual int GetAlpha ()
01317     { return scfParent->GetAlpha (); }
01318     virtual void SetAlpha (int iAlpha)
01319     { scfParent->SetAlpha (iAlpha); }
01320 
01321     virtual void CreatePlane (const csVector3 &iOrigin,
01322       const csMatrix3 &iMatrix);
01323     virtual bool SetPlane (const char *iName);
01324 
01325     virtual csFlags& GetFlags ()
01326     { return scfParent->flags; }
01327 
01328     virtual void SetLightingMode (bool iGouraud)
01329     { scfParent->SetTextureType(iGouraud ? POLYTXT_GOURAUD:POLYTXT_LIGHTMAP); }
01330 
01331     virtual iPortal* CreateNullPortal ()
01332     {
01333       scfParent->SetCSPortal (NULL, true);
01334       return &(scfParent->GetPortal ()->scfiPortal);
01335     }
01336     virtual iPortal* CreatePortal (iSector *iTarget)
01337     {
01338       scfParent->SetCSPortal (iTarget->GetPrivateObject ());
01339       return &(scfParent->GetPortal ()->scfiPortal);
01340     }
01341     virtual iPortal* GetPortal ()
01342     {
01343       csPortal* prt = scfParent->GetPortal ();
01344       if (prt)
01345         return &(prt->scfiPortal);
01346       else
01347         return NULL;
01348     }
01349 
01350     virtual void SetTextureSpace (
01351         const csVector3& p1, const csVector2& uv1,
01352         const csVector3& p2, const csVector2& uv2,
01353         const csVector3& p3, const csVector2& uv3)
01354     {
01355       scfParent->SetTextureSpace (p1, uv1, p2, uv2, p3, uv3);
01356     }
01357     virtual void SetTextureSpace (const csVector3& v_orig, 
01358       const csVector3& v1, float l1)
01359     {
01360       scfParent->SetTextureSpace (v_orig, v1, l1);
01361     }
01362     virtual void SetTextureSpace (
01363         const csVector3& v_orig,
01364         const csVector3& v1, float len1,
01365         const csVector3& v2, float len2)
01366     {
01367       scfParent->SetTextureSpace (v_orig, v1, len1, v2, len2);
01368     }
01369     virtual void SetTextureSpace (csMatrix3 const& m, csVector3 const& v)
01370     {
01371       scfParent->SetTextureSpace (m, v);
01372     }
01373     virtual void SetTextureSpace (iPolyTxtPlane* plane);
01374 
01375     virtual void SetTextureType (int type)
01376     {
01377       scfParent->SetTextureType (type);
01378     }
01379     virtual int GetTextureType ()
01380     {
01381       return scfParent->GetTextureType ();
01382     }
01383     virtual void CopyTextureType (iPolygon3D* other_polygon)
01384     {
01385       scfParent->CopyTextureType (other_polygon);
01386     }
01387 
01388     virtual const csPlane3& GetWorldPlane ()
01389     {
01390       return scfParent->plane->GetWorldPlane ();
01391     }
01392     virtual const csPlane3& GetObjectPlane ()
01393     {
01394       return scfParent->plane->GetObjectPlane ();
01395     }
01396     virtual const csPlane3& GetCameraPlane ()
01397     {
01398       return scfParent->plane->GetCameraPlane ();
01399     }
01400     virtual bool IsTransparent ()
01401     {
01402       return scfParent->IsTransparent ();
01403     }
01404     virtual float GetCosinusFactor ()
01405     {
01406       return scfParent->GetCosinusFactor ();
01407     }
01408     virtual void SetCosinusFactor (float cosfact)
01409     {
01410       scfParent->SetCosinusFactor (cosfact);
01411     }
01412     virtual iPolyTexType* GetPolyTexType ();
01413     virtual void UpdateVertexLighting (iLight* light, const csColor& lcol,
01414         bool dynamic, bool reset)
01415     {
01416       scfParent->UpdateVertexLighting (light, lcol, dynamic, reset);
01417     }
01418     virtual unsigned long GetPolygonID ()
01419     {
01420       return scfParent->GetPolygonID ();
01421     }
01422     virtual bool IntersectSegment (const csVector3& start, const csVector3& end,
01423                           csVector3& isect, float* pr = NULL)
01424     {
01425       return scfParent->IntersectSegment (start, end, isect, pr);
01426     }
01427     virtual bool IntersectRay (const csVector3& start, const csVector3& end)
01428     {
01429       return scfParent->IntersectRay (start, end);
01430     }
01431     virtual bool IntersectRayNoBackFace (const csVector3& start,
01432       const csVector3& end)
01433     {
01434       return scfParent->IntersectRayNoBackFace (start, end);
01435     }
01436     virtual bool IntersectRayPlane (const csVector3& start,
01437       const csVector3& end, csVector3& isect)
01438     {
01439       return scfParent->IntersectRayPlane (start, end, isect);
01440     }
01441     virtual bool PointOnPolygon (const csVector3& v)
01442     {
01443       return scfParent->PointOnPolygon (v);
01444     }
01445   } scfiPolygon3D;
01446   friend struct eiPolygon3D;
01447 };
01448 
01449 #endif // __CS_POLYGON_H__

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