Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

rview.h

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 __IENGINE_RVIEW_H__
00020 #define __IENGINE_RVIEW_H__
00021 
00022 #include "csutil/scf.h"
00023 #include "csgeom/plane3.h"
00024 #include "csgeom/transfrm.h"
00025 #include "csgeom/box.h"
00026 #include "ivideo/graph3d.h"
00027 #include "iengine/engine.h"
00028 
00029 struct iEngine;
00030 struct iClipper2D;
00031 struct iGraphics2D;
00032 struct iGraphics3D;
00033 struct iCamera;
00034 struct iSector;
00035 struct iPolygon3D;
00036 struct csFog;
00037 class csRenderView;
00038 class csReversibleTransform;
00039 class csVector3;
00040 class csSphere;
00041 
00049 class csFogInfo
00050 {
00051 public:
00053   csFogInfo* next;
00054 
00056   csPlane3 incoming_plane;
00058   csPlane3 outgoing_plane;
00063   bool has_incoming_plane;
00064 
00070   bool has_outgoing_plane;
00071 
00073   csFog* fog;
00074 };
00075 
00080 class csRenderContextFrustum
00081 {
00082   class csRenderContext;
00083   friend class csRenderContext; // To avoid gcc warning!
00084 
00085 private:
00086   int ref_count;
00087 
00088   ~csRenderContextFrustum () { }
00089 
00090 public:
00095   csVector3 frustum[4];
00096 
00097   csRenderContextFrustum () : ref_count (1) { }
00098   void IncRef () { ref_count++; }
00099   void DecRef () { --ref_count; if (ref_count <= 0) delete this; }
00100 };
00101 
00108 class csRenderContext
00109 {
00110   friend class csRenderView;
00111 
00112 private:
00116   void* rcdata;
00117 
00118 public:
00120   iCamera* icamera;
00122   iClipper2D* iview;
00124   csRenderContextFrustum* iview_frustum;
00125 
00127   iPolygon3D* portal_polygon;
00129   iSector* previous_sector;
00131   iSector* this_sector;
00132 
00137   csPlane3 clip_plane;
00138 
00149   bool do_clip_plane;
00150 
00159   bool do_clip_frustum;
00160 
00165   csFogInfo* fog_info;
00166 
00171   bool added_fog_info;
00172 
00178   int draw_rec_level;
00179 };
00180 
00181 SCF_VERSION (iRenderView, 0, 3, 0);
00182 
00187 struct iRenderView : public iBase
00188 {
00190   virtual csRenderContext* GetRenderContext () = 0;
00198   virtual void CreateRenderContext () = 0;
00204   virtual void RestoreRenderContext (csRenderContext* original) = 0;
00210   virtual iCamera* CreateNewCamera () = 0;
00211 
00213   virtual iEngine* GetEngine () = 0;
00215   virtual iGraphics2D* GetGraphics2D () = 0;
00217   virtual iGraphics3D* GetGraphics3D () = 0;
00219   virtual void SetFrustum (float lx, float rx, float ty, float by) = 0;
00221   virtual void GetFrustum (float& lx, float& rx, float& ty, float& by) = 0;
00223   virtual csRenderContextFrustum* GetTopFrustum () = 0;
00224 
00225   //-----------------------------------------------------------------
00226   // The following functions operate on the current render context.
00227   //-----------------------------------------------------------------
00228 
00230   virtual iClipper2D* GetClipper () = 0;
00232   virtual void SetClipper (iClipper2D* clip) = 0;
00239   virtual bool IsClipperRequired () = 0;
00246   virtual bool GetClipPlane (csPlane3& pl) = 0;
00248   virtual csPlane3& GetClipPlane () = 0;
00252   virtual void SetClipPlane (const csPlane3& pl) = 0;
00254   virtual void UseClipPlane (bool u) = 0;
00256   virtual void UseClipFrustum (bool u) = 0;
00257 
00263   virtual csFogInfo* GetFirstFogInfo () = 0;
00267   virtual void SetFirstFogInfo (csFogInfo* fi) = 0;
00271   virtual bool AddedFogInfo () = 0;
00275   virtual void ResetFogInfo () = 0;
00279   virtual iCamera* GetCamera () = 0;
00283   virtual void CalculateFogPolygon (G3DPolygonDP& poly) = 0;
00287   virtual void CalculateFogPolygon (G3DPolygonDPFX& poly) = 0;
00294   virtual void CalculateFogMesh (const csTransform& tr_o2c,
00295         G3DTriangleMesh& mesh) = 0;
00296 
00304   virtual void CalculateFogMesh (const csTransform &tr_o2c, 
00305     G3DPolygonMesh &mesh) = 0;
00306 
00307 
00313   virtual bool TestBSphere (const csReversibleTransform& o2c,
00314         const csSphere& sphere) = 0;
00323   virtual bool ClipBSphere (const csReversibleTransform& o2c,
00324         const csSphere& sphere,
00325         int& clip_portal, int& clip_plane, int& clip_z_plane) = 0;
00326 
00334   virtual bool ClipBBox (const csBox2& sbox, const csBox3& cbox,
00335         int& clip_portal, int& clip_plane, int& clip_z_plane) = 0;
00336 
00340   virtual iSector* GetThisSector () = 0;
00341 
00345   virtual void SetThisSector (iSector* s) = 0;
00346 
00350   virtual iSector* GetPreviousSector () = 0;
00351 
00355   virtual void SetPreviousSector (iSector* s) = 0;
00356 
00360   virtual iPolygon3D* GetPortalPolygon () = 0;
00361 
00365   virtual void SetPortalPolygon (iPolygon3D* poly) = 0;
00366 
00370   virtual int GetRenderRecursionLevel () = 0;
00374   virtual void SetRenderRecursionLevel (int rec) = 0;
00375 
00379   virtual void AttachRenderContextData (void* key, iBase* data) = 0;
00383   virtual iBase* FindRenderContextData (void* key) = 0;
00388   virtual void DeleteRenderContextData (void* key) = 0;
00389 
00394   virtual void SetCallback (iDrawFuncCallback* cb) = 0;
00398   virtual iDrawFuncCallback* GetCallback () = 0;
00402   virtual void CallCallback (int type, void* data) = 0;
00403 
00408   virtual iCamera* GetOriginalCamera () const = 0;
00409 };
00410 
00411 #endif
00412 

Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000