Crystal Space: iengine/rview.h Source File (Crystal Space Public API Reference)

| ## 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
    00181 struct iRenderView : public virtual iBase
    00182 {
    00183   SCF_INTERFACE(iRenderView, 2,0,0);
    00185   virtual csRenderContext* GetRenderContext () = 0;
    00186
    00188   virtual iEngine* GetEngine () = 0;
    00190   virtual iGraphics2D* GetGraphics2D () = 0;
    00192   virtual iGraphics3D* GetGraphics3D () = 0;
    00194   virtual void GetFrustum (float& lx, float& rx, float& ty, float& by) = 0;
    00195
    00196   //-----------------------------------------------------------------
    00197   // The following functions operate on the current render context.
    00198   //-----------------------------------------------------------------
    00199
    00201   virtual iClipper2D* GetClipper () = 0;
    00202
    00206   virtual iCamera* GetCamera () = 0;
    00207
    00211   virtual void CalculateClipSettings (uint32 frustum_mask,
    00212     int &clip_portal, int &clip_plane, int &clip_z_plane) = 0;
    00213
    00219   virtual bool TestBSphere (const csReversibleTransform& w2c,
    00220         const csSphere& sphere) = 0;
    00221
    00233   virtual bool ClipBBox (csPlane3* planes, uint32& frustum_mask,
    00234         const csBox3& obox,
    00235         int& clip_portal, int& clip_plane, int& clip_z_plane) = 0;
    00236
    00242   virtual void SetupClipPlanes (const csReversibleTransform& tr_o2c,
    00243         csPlane3* planes, uint32& frustum_mask) = 0;
    00244
    00248   virtual iSector* GetThisSector () = 0;
    00249
    00253   virtual iSector* GetPreviousSector () = 0;
    00254
    00258   virtual iPortal* GetLastPortal () = 0;
    00259
    00264   virtual iCamera* GetOriginalCamera () const = 0;
    00265
    00269   virtual uint GetCurrentFrameNumber () const = 0;
    00270
    00278   virtual bool ClipBSphere (
    00279         const csSphere &cam_sphere,
    00280         const csSphere &world_sphere,
    00281         int& clip_portal, int& clip_plane, int& clip_z_plane) = 0;
    00282
    00283
    00284
    00285   // @@@ ADDED B/C OF FATLOOP PORTAL HACKING
    00286   // @@@ REMOVE AGAIN ASAP
    00287   virtual void CreateRenderContext () = 0;
    00288   virtual int GetRenderRecursionLevel () const = 0;
    00289   virtual void SetRenderRecursionLevel (int rec) = 0;
    00290   virtual void SetClipper (iClipper2D* clip) = 0;
    00291   virtual void ResetFogInfo () = 0;
    00292   virtual void SetPreviousSector (iSector* s) = 0;
    00293   virtual void SetClipPlane (const csPlane3& p) = 0;
    00294   virtual bool GetClipPlane (csPlane3& pl) const = 0;
    00295   virtual const csPlane3& GetClipPlane () const = 0;
    00296   virtual csPlane3& GetClipPlane () = 0;
    00297   virtual void UseClipPlane (bool u) = 0;
    00298   virtual void UseClipFrustum (bool u) = 0;
    00299   virtual void SetLastPortal (iPortal* por) = 0;
    00300   virtual bool IsClipperRequired () const = 0;
    00301   virtual iCamera* CreateNewCamera () = 0;
    00302   virtual void RestoreRenderContext () = 0;
    00303   virtual void SetThisSector (iSector* s) = 0;
    00304   virtual void SetupClipPlanes () = 0;
    00305 };
    00306
    00309 #endif // __CS_IENGINE_RVIEW_H__
    00310