CrystalSpace

Public API Reference

iengine/fview.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2000-2001 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_FVIEW_H__
00020 #define __CS_IENGINE_FVIEW_H__
00021 
00029 #include "csutil/ref.h"
00030 #include "csutil/scf.h"
00031 
00032 #include "csgeom/frustum.h"
00033 
00034 #include "iengine/shadows.h"
00035 
00036 
00037 struct iFrustumView;
00038 struct iMeshWrapper;
00039 class csFrustum;
00040 class csFrustumContext;
00041 
00048 struct iFrustumViewUserdata : public virtual iBase
00049 {
00050   SCF_INTERFACE(iFrustumViewUserdata,2,0,0);
00051 };
00052 
00057 typedef void (csFrustumViewObjectFunc)(iMeshWrapper* mesh,
00058   iFrustumView* lview, bool vis);
00059 
00066 class csFrustumContext
00067 {
00068 private:
00074   csRef<iShadowBlockList> shadows;
00079   bool shared;
00080 
00082   bool mirror;
00083 
00088   csRef<csFrustum> light_frustum;
00089 
00090 public:
00092   csFrustumContext () :
00093     shared (false),
00094     mirror (false)
00095   { }
00096 
00097   csFrustumContext& operator= (csFrustumContext const& c)
00098   {
00099     shadows = c.shadows;
00100     shared = c.shared;
00101     mirror = c.mirror;
00102     light_frustum = c.light_frustum;
00103     return *this;
00104   }
00105 
00107   iShadowBlockList* GetShadows () { return shadows; }
00109   void SetShadows (iShadowBlockList* shad, bool sh = true)
00110   {
00111     shadows = shad;
00112     shared = sh;
00113   }
00115   void SetNewShadows (csPtr<iShadowBlockList> shad, bool sh = false)
00116   {
00117     shadows = shad;
00118     shared = sh;
00119   }
00121   bool IsShared () { return shared; }
00122 
00124   void SetLightFrustum (csFrustum* lf) { light_frustum = lf; }
00126   void SetNewLightFrustum (csPtr<csFrustum> lf) { light_frustum = lf; }
00128   csFrustum* GetLightFrustum () { return light_frustum; }
00129 
00134   void SetMirrored (bool m) { mirror = m; }
00136   bool IsMirrored () { return mirror; }
00137 };
00138 
00139 
00144 struct iFrustumView : public virtual iBase
00145 {
00146   SCF_INTERFACE(iFrustumView,2,0,0);
00147 
00149   virtual csFrustumContext* GetFrustumContext () const = 0;
00157   virtual void CreateFrustumContext () = 0;
00162   virtual csFrustumContext* CopyFrustumContext () = 0;
00167   virtual void SetFrustumContext (csFrustumContext* ctxt) = 0;
00173   virtual void RestoreFrustumContext (csFrustumContext* original) = 0;
00174 
00176   virtual void SetObjectFunction (csFrustumViewObjectFunc* func) = 0;
00178   virtual void CallObjectFunction (iMeshWrapper* mesh, bool vis) = 0;
00179 
00181   virtual float GetRadius () const = 0;
00183   virtual float GetSquaredRadius () const = 0;
00185   virtual bool CheckShadowMask (unsigned int mask) = 0;
00187   virtual bool CheckProcessMask (unsigned int mask) = 0;
00188 
00190   virtual void StartNewShadowBlock () = 0;
00191 
00193   virtual void SetUserdata (iFrustumViewUserdata* data) = 0;
00195   virtual iFrustumViewUserdata* GetUserdata () = 0;
00196 };
00197 
00200 #endif // __CS_IENGINE_FVIEW_H__
00201 

Generated for Crystal Space by doxygen 1.4.7