CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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 
00028 #include "csutil/scf.h"
00029 #include "csgeom/plane3.h"
00030 #include "csgeom/transfrm.h"
00031 #include "csgeom/box.h"
00032 #include "iengine/engine.h"
00033 
00034 #include "ivideo/graph3d.h"
00035 
00036 struct csFog;
00037 struct iEngine;
00038 struct iClipper2D;
00039 struct iGraphics2D;
00040 struct iGraphics3D;
00041 struct iCamera;
00042 struct iSector;
00043 struct iPolygon3D;
00044 class csRenderView;
00045 class csReversibleTransform;
00046 class csVector3;
00047 class csSphere;
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 
00087 class csRenderContextFrustum
00088 {
00089   class csRenderContext;
00090   friend class csRenderContext; // To avoid gcc warning!
00091 
00092 private:
00093   int ref_count;
00094 
00095   ~csRenderContextFrustum () { }
00096 
00097 public:
00102   csVector3 frustum[4];
00103 
00104   csRenderContextFrustum () : ref_count (1) { }
00105   void IncRef () { ref_count++; }
00106   void DecRef () { --ref_count; if (ref_count <= 0) delete this; }
00107 };
00108 
00115 class csRenderContext
00116 {
00117   friend class csRenderView;
00118 
00119 private:
00123   void* rcdata;
00124 
00125 public:
00127   iCamera* icamera;
00129   iClipper2D* iview;
00131   csRenderContextFrustum* iview_frustum;
00132 
00134   iPolygon3D* portal_polygon;
00136   iSector* previous_sector;
00138   iSector* this_sector;
00139 
00144   csPlane3 clip_plane;
00145 
00156   bool do_clip_plane;
00157 
00166   bool do_clip_frustum;
00167 
00172   csFogInfo* fog_info;
00173 
00178   bool added_fog_info;
00179 
00185   int draw_rec_level;
00186 };
00187 
00188 SCF_VERSION (iRenderView, 0, 4, 0);
00189 
00194 struct iRenderView : public iBase
00195 {
00197   virtual csRenderContext* GetRenderContext () = 0;
00205   virtual void CreateRenderContext () = 0;
00211   virtual void RestoreRenderContext (csRenderContext* original) = 0;
00217   virtual iCamera* CreateNewCamera () = 0;
00218 
00220   virtual iEngine* GetEngine () = 0;
00222   virtual iGraphics2D* GetGraphics2D () = 0;
00224   virtual iGraphics3D* GetGraphics3D () = 0;
00226   virtual void SetFrustum (float lx, float rx, float ty, float by) = 0;
00228   virtual void GetFrustum (float& lx, float& rx, float& ty, float& by) = 0;
00230   virtual csRenderContextFrustum* GetTopFrustum () = 0;
00231 
00232   //-----------------------------------------------------------------
00233   // The following functions operate on the current render context.
00234   //-----------------------------------------------------------------
00235 
00237   virtual iClipper2D* GetClipper () = 0;
00239   virtual void SetClipper (iClipper2D* clip) = 0;
00246   virtual bool IsClipperRequired () = 0;
00253   virtual bool GetClipPlane (csPlane3& pl) = 0;
00255   virtual csPlane3& GetClipPlane () = 0;
00259   virtual void SetClipPlane (const csPlane3& pl) = 0;
00261   virtual void UseClipPlane (bool u) = 0;
00263   virtual void UseClipFrustum (bool u) = 0;
00264 
00270   virtual csFogInfo* GetFirstFogInfo () = 0;
00274   virtual void SetFirstFogInfo (csFogInfo* fi) = 0;
00278   virtual bool AddedFogInfo () = 0;
00282   virtual void ResetFogInfo () = 0;
00286   virtual iCamera* GetCamera () = 0;
00287 
00292   virtual void CalculateFogPolygon (G3DPolygonDP& poly) = 0;
00297   virtual void CalculateFogPolygon (G3DPolygonDPFX& poly) = 0;
00305   virtual void CalculateFogMesh (const csTransform& tr_o2c,
00306         G3DTriangleMesh& mesh) = 0;
00307 
00315   virtual void CalculateFogMesh (const csTransform &tr_o2c, 
00316     G3DPolygonMesh &mesh) = 0;
00317 
00318 
00324   virtual bool TestBSphere (const csReversibleTransform& o2c,
00325         const csSphere& sphere) = 0;
00334   virtual bool ClipBSphere (const csReversibleTransform& o2c,
00335         const csSphere& sphere,
00336         int& clip_portal, int& clip_plane, int& clip_z_plane) = 0;
00337 
00345   virtual bool ClipBBox (const csBox2& sbox, const csBox3& cbox,
00346         int& clip_portal, int& clip_plane, int& clip_z_plane) = 0;
00347 
00351   virtual iSector* GetThisSector () = 0;
00352 
00356   virtual void SetThisSector (iSector* s) = 0;
00357 
00361   virtual iSector* GetPreviousSector () = 0;
00362 
00366   virtual void SetPreviousSector (iSector* s) = 0;
00367 
00371   virtual iPolygon3D* GetPortalPolygon () = 0;
00372 
00376   virtual void SetPortalPolygon (iPolygon3D* poly) = 0;
00377 
00381   virtual int GetRenderRecursionLevel () = 0;
00385   virtual void SetRenderRecursionLevel (int rec) = 0;
00386 
00390   virtual void AttachRenderContextData (void* key, iBase* data) = 0;
00394   virtual iBase* FindRenderContextData (void* key) = 0;
00399   virtual void DeleteRenderContextData (void* key) = 0;
00400 
00405   virtual iCamera* GetOriginalCamera () const = 0;
00406 };
00407 
00410 #endif // __CS_IENGINE_RVIEW_H__
00411 

Generated for Crystal Space by doxygen 1.2.14