## Public API Reference

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

- File List
- File Members

# iengine/rview.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2000 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_RVIEW_H__
    00020 #define __CS_IENGINE_RVIEW_H__
    00021
    00029 #include "csutil/scf.h"
    00030
    00031 #include "csgeom/plane3.h"
    00032
    00033 struct iCamera;
    00034 struct iClipper2D;
    00035 struct iEngine;
    00036 struct iGraphics2D;
    00037 struct iGraphics3D;
    00038 struct iPortal;
    00039 struct iSector;
    00040
    00041 struct csFog;
    00042
    00043 class csBox3;
    00044 class csRenderView;
    00045 class csReversibleTransform;
    00046 class csSphere;
    00047 class csVector3;
    00048
    00056 class csFogInfo
    00057 {
    00058 public:
    00060   csFogInfo* next;
    00061
    00063   csPlane3 incoming_plane;
    00065   csPlane3 outgoing_plane;
    00070   bool has_incoming_plane;
    00071
    00077   bool has_outgoing_plane;
    00078
    00080   csFog* fog;
    00081 };
    00082
    00089 class csRenderContext
    00090 {
    00091   friend class csRenderView;
    00092
    00093 public:
    00095   csRenderContext* previous;
    00096
    00098   csRef<iCamera> icamera;
    00100   csRef<iClipper2D> iview;
    00102   csPlane3 frustum[5];
    00103
    00105   csPlane3 clip_planes[7];
    00107   uint32 clip_planes_mask;
    00108
    00110   iPortal* last_portal;
    00112   iSector* previous_sector;
    00114   iSector* this_sector;
    00115
    00120   csPlane3 clip_plane;
    00121
    00132   bool do_clip_plane;
    00133
    00142   bool do_clip_frustum;
    00143
    00148   csFogInfo* fog_info;
    00149
    00154   bool added_fog_info;
    00155
    00161   int draw_rec_level;
    00162
    00168   uint32 context_id;
    00169 };
    00170
    00175 struct iRenderView : public virtual iBase
    00176 {
    00177   SCF_INTERFACE(iRenderView, 2,0,0);
    00179   virtual csRenderContext* GetRenderContext () = 0;
    00180
    00182   virtual iEngine* GetEngine () = 0;
    00184   virtual iGraphics2D* GetGraphics2D () = 0;
    00186   virtual iGraphics3D* GetGraphics3D () = 0;
    00188   virtual void GetFrustum (float& lx, float& rx, float& ty, float& by) = 0;
    00189
    00190   //-----------------------------------------------------------------
    00191   // The following functions operate on the current render context.
    00192   //-----------------------------------------------------------------
    00193
    00195   virtual iClipper2D* GetClipper () = 0;
    00196
    00200   virtual iCamera* GetCamera () = 0;
    00201
    00205   virtual void CalculateClipSettings (uint32 frustum_mask,
    00206     int &clip_portal, int &clip_plane, int &clip_z_plane) = 0;
    00207
    00213   virtual bool TestBSphere (const csReversibleTransform& w2c,
    00214         const csSphere& sphere) = 0;
    00215
    00227   virtual bool ClipBBox (csPlane3* planes, uint32& frustum_mask,
    00228         const csBox3& obox,
    00229         int& clip_portal, int& clip_plane, int& clip_z_plane) = 0;
    00230
    00236   virtual void SetupClipPlanes (const csReversibleTransform& tr_o2c,
    00237         csPlane3* planes, uint32& frustum_mask) = 0;
    00238
    00242   virtual iSector* GetThisSector () = 0;
    00243
    00247   virtual iSector* GetPreviousSector () = 0;
    00248
    00252   virtual iPortal* GetLastPortal () = 0;
    00253
    00258   virtual iCamera* GetOriginalCamera () const = 0;
    00259
    00263   virtual uint GetCurrentFrameNumber () const = 0;
    00264
    00272   virtual bool ClipBSphere (
    00273         const csSphere &cam_sphere,
    00274         const csSphere &world_sphere,
    00275         int& clip_portal, int& clip_plane, int& clip_z_plane) = 0;
    00276
    00277
    00278
    00279   // @@@ ADDED B/C OF FATLOOP PORTAL HACKING
    00280   // @@@ REMOVE AGAIN ASAP
    00281   virtual void CreateRenderContext () = 0;
    00282   virtual int GetRenderRecursionLevel () const = 0;
    00283   virtual void SetRenderRecursionLevel (int rec) = 0;
    00284   virtual void SetClipper (iClipper2D* clip) = 0;
    00285   virtual void ResetFogInfo () = 0;
    00286   virtual void SetPreviousSector (iSector* s) = 0;
    00287   virtual void SetClipPlane (const csPlane3& p) = 0;
    00288   virtual bool GetClipPlane (csPlane3& pl) const = 0;
    00289   virtual const csPlane3& GetClipPlane () const = 0;
    00290   virtual csPlane3& GetClipPlane () = 0;
    00291   virtual void UseClipPlane (bool u) = 0;
    00292   virtual void UseClipFrustum (bool u) = 0;
    00293   virtual void SetLastPortal (iPortal* por) = 0;
    00294   virtual bool IsClipperRequired () const = 0;
    00295   virtual iCamera* CreateNewCamera () = 0;
    00296   virtual void RestoreRenderContext () = 0;
    00297   virtual void SetThisSector (iSector* s) = 0;
    00298   virtual void SetupClipPlanes () = 0;
    00299 };
    00300
    00303 #endif // __CS_IENGINE_RVIEW_H__
    00304