iengine/portal.h Source File (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 #include "iutil/object.h"
    00031
    00032 class csFlags;
    00033 class csMatrix3;
    00034 class csPlane3;
    00035 class csReversibleTransform;
    00036 class csTransform;
    00037 class csVector3;
    00038 class csSphere;
    00039
    00040 struct iMaterialWrapper;
    00041 struct iMeshWrapper;
    00042 struct iMovable;
    00043 struct iObject;
    00044 struct iPortal;
    00045 struct iSector;
    00046 struct iTextureHandle;
    00047
    00048
    00049
    00055 #define CS_PORTAL_CLIPDEST 0x00000001
    00056
    00064 #define CS_PORTAL_CLIPSTRADDLING 0x00000002
    00065
    00074 #define CS_PORTAL_ZFILL 0x00000004
    00075
    00082 #define CS_PORTAL_WARP 0x00000008
    00083
    00089 #define CS_PORTAL_MIRROR 0x00000010
    00090
    00097 #define CS_PORTAL_STATICDEST 0x00000020
    00098
    00108 #define CS_PORTAL_FLOAT 0x00000040
    00109
    00113 #define CS_PORTAL_COLLDET 0x00000080
    00114
    00118 #define CS_PORTAL_VISCULL 0x00000100
    00119
    00120
    00131 struct iPortalCallback : public virtual iBase
    00132 {
    00133   SCF_INTERFACE (iPortalCallback, 1, 0, 0);
    00134
    00139   virtual bool Traverse (iPortal* portal, iBase* context) = 0;
    00140 };
    00141
    00159 struct iPortal : public virtual iBase
    00160 {
    00161   SCF_INTERFACE(iPortal, 2,0,1);
    00162
    00164   virtual void SetName (const char* name) = 0;
    00166   virtual const char* GetName () const = 0;
    00167
    00169   virtual iSector* GetSector () const = 0;
    00170
    00175   virtual const csVector3* GetVertices () const = 0;
    00176
    00181   virtual const csVector3* GetWorldVertices () = 0;
    00182
    00187   virtual int* GetVertexIndices () const = 0;
    00188
    00192   virtual int GetVertexIndicesCount () const = 0;
    00193
    00197   virtual const csPlane3& GetObjectPlane () = 0;
    00198
    00202   virtual const csPlane3& GetWorldPlane () = 0;
    00203
    00208   virtual const csSphere& GetObjectSphere () = 0;
    00209
    00214   virtual const csSphere& GetWorldSphere () = 0;
    00215
    00219   virtual void ComputeCameraPlane (const csReversibleTransform& t,
    00220         csPlane3& camplane) = 0;
    00221
    00226   virtual bool PointOnPolygon (const csVector3& point) = 0;
    00227
    00232   virtual void SetSector (iSector* s) = 0;
    00233
    00235   virtual csFlags& GetFlags () = 0;
    00236
    00243   virtual void SetMaximumSectorVisit (int msv) = 0;
    00245   virtual int GetMaximumSectorVisit () const = 0;
    00246
    00253   virtual void SetPortalCallback (iPortalCallback* cb) = 0;
    00254
    00258   virtual void RemovePortalCallback (iPortalCallback* cb) = 0;
    00259
    00261   virtual int GetPortalCallbackCount () const = 0;
    00262
    00264   virtual iPortalCallback* GetPortalCallback (int idx) const = 0;
    00265
    00272   virtual void SetMissingSectorCallback (iPortalCallback* cb) = 0;
    00273
    00277   virtual void RemoveMissingSectorCallback (iPortalCallback* cb) = 0;
    00278
    00280   virtual int GetMissingSectorCallbackCount () const = 0;
    00281
    00283   virtual iPortalCallback* GetMissingSectorCallback (int idx) const = 0;
    00284
    00289   CS_DEPRECATED_METHOD_MSG("Use portal materials.")
    00290   virtual void SetFilter (iTextureHandle* ft) = 0;
    00295   CS_DEPRECATED_METHOD_MSG("Use portal materials.")
    00296   virtual iTextureHandle* GetTextureFilter () const = 0;
    00297
    00302   CS_DEPRECATED_METHOD_MSG("Use portal materials.")
    00303   virtual void SetFilter (float r, float g, float b) = 0;
    00308   CS_DEPRECATED_METHOD_MSG("Use portal materials.")
    00309   virtual void GetColorFilter (float &r, float &g, float &b) const = 0;
    00310
    00311   //---- space warping ------------------------------------------------------
    00312
    00317   virtual void SetWarp (const csMatrix3 &m_w, const csVector3 &v_w_before,
    00318     const csVector3 &v_w_after) = 0;
    00323   virtual void SetWarp (const csTransform& t) = 0;
    00324
    00326   virtual void SetMirror (const csPlane3& plane) = 0;
    00327
    00329   virtual const csReversibleTransform &GetWarp () const = 0;
    00330
    00332   virtual void HardTransform (const csReversibleTransform& t) = 0;
    00333
    00338   virtual void ObjectToWorld (const csReversibleTransform& t,
    00339         csReversibleTransform& warp_wor) const = 0;
    00340
    00345   virtual csVector3 Warp (const csReversibleTransform& t,
    00346                   const csVector3& pos) const = 0;
    00347
    00359   virtual void WarpSpace (const csReversibleTransform& warp_wor,
    00360                   csReversibleTransform& t, bool& mirror) const = 0;
    00361
    00362   //-------------------------------------------------------------------------
    00363
    00369   virtual bool CompleteSector (iBase* context) = 0;
    00370
    00380   virtual iMeshWrapper* HitBeamPortals (const csReversibleTransform& t,
    00381         const csVector3& start, const csVector3& end,
    00382         csVector3& isect, int* polygon_idx, iSector** final_sector = 0) = 0;
    00383
    00387   virtual size_t GetVerticesCount () const = 0;
    00388
    00390   virtual iMaterialWrapper* GetMaterial() const = 0;
    00392   virtual void SetMaterial (iMaterialWrapper* mat) = 0;
    00393 };
    00394
    00397 #endif // __CS_IENGINE_PORTAL_H__
    00398