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 __IENGINE_POLYGON_H__
00020 #define __IENGINE_POLYGON_H__
00021 
00022 #include "csutil/scf.h"
00023 #include "csgeom/plane3.h"
00024 #include "csutil/flags.h"
00025 
00026 struct iMaterialHandle;
00027 struct iMaterialWrapper;
00028 struct iPolygon3D;
00029 struct iPolyTxtPlane;
00030 struct iPolygonTexture;
00031 struct iLight;
00032 struct iLightMap;
00033 struct iPortal;
00034 struct iSector;
00035 struct iThingState;
00036 struct iPolyTexType;
00037 struct iObject;
00038 
00039 class csPolygon3D;
00040 class csVector3;
00041 class csVector2;
00042 class csMatrix3;
00043 class csColor;
00044 
00049 #define CS_POLY_LIGHTING 0x00000001
00050 
00054 #define CS_POLY_COLLDET 0x00000002
00055 
00056 
00057 SCF_VERSION (iPolygon3D, 0, 1, 14);
00058 
00062 struct iPolygon3D : public iBase
00063 {
00065   virtual csPolygon3D *GetPrivateObject () = 0;
00066 
00068   virtual iObject *QueryObject() = 0;
00073   virtual iThingState *GetParent () = 0;
00075   virtual iLightMap *GetLightMap () = 0;
00077   virtual iPolygonTexture *GetTexture () = 0;
00079   virtual iMaterialHandle *GetMaterialHandle () = 0;
00081   virtual void SetMaterial (iMaterialWrapper* mat) = 0;
00083   virtual iMaterialWrapper* GetMaterial () = 0;
00084 
00086   virtual int GetVertexCount () = 0;
00088   virtual int* GetVertexIndices () = 0;
00090   virtual const csVector3 &GetVertex (int idx) const = 0;
00092   virtual const csVector3 &GetVertexW (int idx) const = 0;
00094   virtual const csVector3 &GetVertexC (int idx) const = 0;
00096   virtual int CreateVertex (int idx) = 0;
00098   virtual int CreateVertex (const csVector3 &iVertex) = 0;
00099 
00101   virtual int GetAlpha () = 0;
00108   virtual void SetAlpha (int iAlpha) = 0;
00109 
00111   virtual void CreatePlane (const csVector3 &iOrigin,
00112     const csMatrix3 &iMatrix) = 0;
00114   virtual bool SetPlane (const char *iName) = 0;
00115 
00117   virtual csFlags& GetFlags () = 0;
00118 
00120   virtual void SetLightingMode (bool iGouraud) = 0;
00121 
00127   virtual iPortal* CreateNullPortal () = 0;
00129   virtual iPortal *CreatePortal (iSector *iTarget) = 0;
00133   virtual iPortal* GetPortal () = 0;
00134 
00139   virtual void SetTextureSpace (
00140         const csVector3& p1, const csVector2& uv1,
00141         const csVector3& p2, const csVector2& uv2,
00142         const csVector3& p3, const csVector2& uv3) = 0;
00143 
00159   virtual void SetTextureSpace (const csVector3& v_orig,
00160     const csVector3& v1, float l1) = 0;
00161 
00166   virtual void SetTextureSpace (
00167     const csVector3& v_orig,
00168     const csVector3& v1, float len1,
00169     const csVector3& v2, float len2) = 0;
00170 
00175   virtual void SetTextureSpace (csMatrix3 const&, csVector3 const&) = 0;
00176 
00180   virtual void SetTextureSpace (iPolyTxtPlane* plane) = 0;
00181 
00188   virtual void SetTextureType (int type) = 0;
00194   virtual void CopyTextureType (iPolygon3D* other_polygon) = 0;
00195 
00199   virtual int GetTextureType () = 0;
00200 
00202   virtual const csPlane3& GetWorldPlane () = 0;
00204   virtual const csPlane3& GetObjectPlane () = 0;
00206   virtual const csPlane3& GetCameraPlane () = 0;
00207 
00211   virtual bool IsTransparent () = 0;
00212 
00216   virtual float GetCosinusFactor () = 0;
00220   virtual void SetCosinusFactor (float cosfact) = 0;
00224   virtual iPolyTexType* GetPolyTexType () = 0;
00225 
00240   virtual void UpdateVertexLighting (iLight* light, const csColor& lcol,
00241         bool dynamic, bool reset) = 0;
00246   virtual unsigned long GetPolygonID () = 0;
00247 
00252   virtual bool IntersectSegment (const csVector3& start, const csVector3& end,
00253                           csVector3& isect, float* pr = NULL) = 0;
00254 
00262   virtual bool IntersectRay (const csVector3& start, const csVector3& end) = 0;
00263 
00271   virtual bool IntersectRayNoBackFace (const csVector3& start,
00272     const csVector3& end) = 0;
00273 
00281   virtual bool IntersectRayPlane (const csVector3& start, const csVector3& end,
00282         csVector3& isect) = 0;
00283 
00288   virtual bool PointOnPolygon (const csVector3& v) = 0;
00289 };
00290 
00291 SCF_VERSION (iPolygonTexture, 1, 0, 0);
00292 
00297 struct iPolygonTexture : public iBase
00298 {
00300   virtual iMaterialHandle *GetMaterialHandle () = 0;
00302   virtual float GetFDU () = 0;
00304   virtual float GetFDV () = 0;
00306   virtual int GetWidth () = 0;
00308   virtual int GetHeight () = 0;
00311   virtual int GetShiftU () = 0;
00312 
00314   virtual int GetIMinU () = 0;
00316   virtual int GetIMinV () = 0;
00318   virtual void GetTextureBox (float& fMinU, float& fMinV,
00319     float& fMaxU, float& fMaxV) = 0;
00321   virtual int GetOriginalWidth () = 0;
00322 
00324   virtual iPolygon3D *GetPolygon () = 0;
00326   virtual bool DynamicLightsDirty () = 0;
00333   virtual bool RecalculateDynamicLights () = 0;
00334 
00336   virtual iLightMap *GetLightMap () = 0;
00338   virtual int GetLightCellSize () = 0;
00340   virtual int GetLightCellShift () = 0;
00341 
00343   virtual void *GetCacheData (int idx) = 0;
00345   virtual void SetCacheData (int idx, void *d) = 0;
00346 };
00347 
00348 #endif // __IENGINE_POLYGON_H__

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