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;
00109   virtual void SetAlpha (int iAlpha) = 0;
00110 
00112   virtual void CreatePlane (const csVector3 &iOrigin,
00113     const csMatrix3 &iMatrix) = 0;
00115   virtual bool SetPlane (const char *iName) = 0;
00116 
00118   virtual csFlags& GetFlags () = 0;
00119 
00121   virtual void SetLightingMode (bool iGouraud) = 0;
00122 
00128   virtual iPortal* CreateNullPortal () = 0;
00130   virtual iPortal *CreatePortal (iSector *iTarget) = 0;
00134   virtual iPortal* GetPortal () = 0;
00135 
00140   virtual void SetTextureSpace (
00141         const csVector3& p1, const csVector2& uv1,
00142         const csVector3& p2, const csVector2& uv2,
00143         const csVector3& p3, const csVector2& uv3) = 0;
00144 
00160   virtual void SetTextureSpace (const csVector3& v_orig, 
00161     const csVector3& v1, float l1) = 0;
00162 
00167   virtual void SetTextureSpace (
00168     const csVector3& v_orig,
00169     const csVector3& v1, float len1,
00170     const csVector3& v2, float len2) = 0;
00171 
00176   virtual void SetTextureSpace (csMatrix3 const&, csVector3 const&) = 0;
00177 
00181   virtual void SetTextureSpace (iPolyTxtPlane* plane) = 0;
00182 
00189   virtual void SetTextureType (int type) = 0;
00195   virtual void CopyTextureType (iPolygon3D* other_polygon) = 0;
00196 
00200   virtual int GetTextureType () = 0;
00201 
00203   virtual const csPlane3& GetWorldPlane () = 0;
00205   virtual const csPlane3& GetObjectPlane () = 0;
00207   virtual const csPlane3& GetCameraPlane () = 0;
00208 
00212   virtual bool IsTransparent () = 0;
00213 
00217   virtual float GetCosinusFactor () = 0;
00221   virtual void SetCosinusFactor (float cosfact) = 0;
00225   virtual iPolyTexType* GetPolyTexType () = 0;
00226 
00241   virtual void UpdateVertexLighting (iLight* light, const csColor& lcol,
00242         bool dynamic, bool reset) = 0;
00247   virtual unsigned long GetPolygonID () = 0;
00248 
00253   virtual bool IntersectSegment (const csVector3& start, const csVector3& end,
00254                           csVector3& isect, float* pr = NULL) = 0;
00255 
00263   virtual bool IntersectRay (const csVector3& start, const csVector3& end) = 0;
00264 
00272   virtual bool IntersectRayNoBackFace (const csVector3& start,
00273     const csVector3& end) = 0;
00274 
00282   virtual bool IntersectRayPlane (const csVector3& start, const csVector3& end,
00283         csVector3& isect) = 0;
00284 
00289   virtual bool PointOnPolygon (const csVector3& v) = 0;
00290 };
00291 
00292 SCF_VERSION (iPolygonTexture, 1, 0, 0);
00293 
00298 struct iPolygonTexture : public iBase
00299 {
00301   virtual iMaterialHandle *GetMaterialHandle () = 0;
00303   virtual float GetFDU () = 0;
00305   virtual float GetFDV () = 0;
00307   virtual int GetWidth () = 0;
00309   virtual int GetHeight () = 0;
00312   virtual int GetShiftU () = 0;
00313 
00315   virtual int GetIMinU () = 0;
00317   virtual int GetIMinV () = 0;
00319   virtual void GetTextureBox (float& fMinU, float& fMinV,
00320     float& fMaxU, float& fMaxV) = 0;
00322   virtual int GetOriginalWidth () = 0;
00323 
00325   virtual iPolygon3D *GetPolygon () = 0;
00327   virtual bool DynamicLightsDirty () = 0;
00334   virtual bool RecalculateDynamicLights () = 0;
00335 
00337   virtual iLightMap *GetLightMap () = 0;
00339   virtual int GetLightCellSize () = 0;
00341   virtual int GetLightCellShift () = 0;
00342 
00344   virtual void *GetCacheData (int idx) = 0;
00346   virtual void SetCacheData (int idx, void *d) = 0;
00347 };
00348 
00349 #endif // __IENGINE_POLYGON_H__

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