CrystalSpace

Public API Reference

iengine/portal.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2003 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_IENGINE_PORTAL_H__
00020 #define __CS_IENGINE_PORTAL_H__
00021 
00029 #include "csutil/scf.h"
00030 
00031 class csFlags;
00032 class csMatrix3;
00033 class csPlane3;
00034 class csReversibleTransform;
00035 class csTransform;
00036 class csVector3;
00037 
00038 struct iFrustumView;
00039 struct iMeshWrapper;
00040 struct iMovable;
00041 struct iObject;
00042 struct iPortal;
00043 struct iSector;
00044 struct iTextureHandle;
00045 
00046 
00047 
00053 #define CS_PORTAL_CLIPDEST 0x00000001
00054 
00062 #define CS_PORTAL_CLIPSTRADDLING 0x00000002
00063 
00072 #define CS_PORTAL_ZFILL 0x00000004
00073 
00080 #define CS_PORTAL_WARP 0x00000008
00081 
00087 #define CS_PORTAL_MIRROR 0x00000010
00088 
00095 #define CS_PORTAL_STATICDEST 0x00000020
00096 
00106 #define CS_PORTAL_FLOAT 0x00000040
00107 
00111 #define CS_PORTAL_COLLDET 0x00000080
00112 
00116 #define CS_PORTAL_VISCULL 0x00000100
00117 
00118 
00129 struct iPortalCallback : public virtual iBase
00130 {
00131   SCF_INTERFACE (iPortalCallback, 1, 0, 0);
00132 
00137   virtual bool Traverse (iPortal* portal, iBase* context) = 0;
00138 };
00139 
00157 struct iPortal : public virtual iBase
00158 {
00159   SCF_INTERFACE(iPortal, 2,0,0);
00160 
00162   virtual void SetName (const char* name) = 0;
00164   virtual const char* GetName () const = 0;
00165 
00167   virtual iSector* GetSector () const = 0;
00168 
00173   virtual const csVector3* GetVertices () const = 0;
00174 
00179   virtual const csVector3* GetWorldVertices () = 0;
00180 
00185   virtual int* GetVertexIndices () const = 0;
00186 
00190   virtual int GetVertexIndicesCount () const = 0;
00191 
00195   virtual const csPlane3& GetObjectPlane () = 0;
00196 
00200   virtual const csPlane3& GetWorldPlane () = 0;
00201 
00205   virtual void ComputeCameraPlane (const csReversibleTransform& t,
00206         csPlane3& camplane) = 0;
00207 
00212   virtual bool PointOnPolygon (const csVector3& point) = 0;
00213 
00218   virtual void SetSector (iSector* s) = 0;
00219 
00221   virtual csFlags& GetFlags () = 0;
00222 
00229   virtual void SetMaximumSectorVisit (int msv) = 0;
00231   virtual int GetMaximumSectorVisit () const = 0;
00232 
00239   virtual void SetPortalCallback (iPortalCallback* cb) = 0;
00240 
00244   virtual void RemovePortalCallback (iPortalCallback* cb) = 0;
00245 
00247   virtual int GetPortalCallbackCount () const = 0;
00248   
00250   virtual iPortalCallback* GetPortalCallback (int idx) const = 0;
00251 
00258   virtual void SetMissingSectorCallback (iPortalCallback* cb) = 0;
00259 
00263   virtual void RemoveMissingSectorCallback (iPortalCallback* cb) = 0;
00264 
00266   virtual int GetMissingSectorCallbackCount () const = 0;
00267   
00269   virtual iPortalCallback* GetMissingSectorCallback (int idx) const = 0;
00270 
00272   virtual void SetFilter (iTextureHandle* ft) = 0;
00274   virtual iTextureHandle* GetTextureFilter () const = 0;
00275 
00277   virtual void SetFilter (float r, float g, float b) = 0;
00279   virtual void GetColorFilter (float &r, float &g, float &b) const = 0;
00280 
00281   //---- space warping ------------------------------------------------------
00282 
00287   virtual void SetWarp (const csMatrix3 &m_w, const csVector3 &v_w_before,
00288     const csVector3 &v_w_after) = 0;
00293   virtual void SetWarp (const csTransform& t) = 0;
00294 
00296   virtual void SetMirror (const csPlane3& plane) = 0;
00297 
00299   virtual const csReversibleTransform &GetWarp () const = 0;
00300 
00302   virtual void HardTransform (const csReversibleTransform& t) = 0;
00303 
00308   virtual void ObjectToWorld (const csReversibleTransform& t,
00309         csReversibleTransform& warp_wor) const = 0;
00310 
00315   virtual csVector3 Warp (const csReversibleTransform& t,
00316                   const csVector3& pos) const = 0;
00317 
00329   virtual void WarpSpace (const csReversibleTransform& warp_wor,
00330                   csReversibleTransform& t, bool& mirror) const = 0;
00331 
00332   //-------------------------------------------------------------------------
00333 
00339   virtual bool CompleteSector (iBase* context) = 0;
00340 
00347   virtual void CheckFrustum (iFrustumView* lview,
00348           const csReversibleTransform& t, int alpha) = 0;
00349 
00359   virtual iMeshWrapper* HitBeamPortals (const csReversibleTransform& t,
00360         const csVector3& start, const csVector3& end,
00361         csVector3& isect, int* polygon_idx, iSector** final_sector = 0) = 0;
00362 
00366   virtual size_t GetVerticesCount () const = 0;
00367 
00368 };
00369 
00372 #endif // __CS_IENGINE_PORTAL_H__
00373 

Generated for Crystal Space 1.2.1 by doxygen 1.5.3