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 
00045 struct iFrustumViewUserdata : public virtual iBase
00046 {
00047   SCF_INTERFACE(iFrustumViewUserdata,2,0,0);
00048 };
00049 
00054 typedef void (csFrustumViewObjectFunc)(iMeshWrapper* mesh,
00055   iFrustumView* lview, bool vis);
00056 
00063 class csFrustumContext
00064 {
00065 private:
00071   csRef<iShadowBlockList> shadows;
00076   bool shared;
00077 
00079   bool mirror;
00080 
00085   csRef<csFrustum> light_frustum;
00086 
00087 public:
00089   csFrustumContext () :
00090     shared (false),
00091     mirror (false)
00092   { }
00093 
00094   csFrustumContext& operator= (csFrustumContext const& c)
00095   {
00096     shadows = c.shadows;
00097     shared = c.shared;
00098     mirror = c.mirror;
00099     light_frustum = c.light_frustum;
00100     return *this;
00101   }
00102 
00104   iShadowBlockList* GetShadows () { return shadows; }
00106   void SetShadows (iShadowBlockList* shad, bool sh = true)
00107   {
00108     shadows = shad;
00109     shared = sh;
00110   }
00112   void SetNewShadows (csPtr<iShadowBlockList> shad, bool sh = false)
00113   {
00114     shadows = shad;
00115     shared = sh;
00116   }
00118   bool IsShared () { return shared; }
00119 
00121   void SetLightFrustum (csFrustum* lf) { light_frustum = lf; }
00123   void SetNewLightFrustum (csPtr<csFrustum> lf) { light_frustum = lf; }
00125   csFrustum* GetLightFrustum () { return light_frustum; }
00126 
00131   void SetMirrored (bool m) { mirror = m; }
00133   bool IsMirrored () { return mirror; }
00134 };
00135 
00136 
00141 struct iFrustumView : public virtual iBase
00142 {
00143   SCF_INTERFACE(iFrustumView,2,0,0);
00144 
00146   virtual csFrustumContext* GetFrustumContext () const = 0;
00154   virtual void CreateFrustumContext () = 0;
00159   virtual csFrustumContext* CopyFrustumContext () = 0;
00164   virtual void SetFrustumContext (csFrustumContext* ctxt) = 0;
00170   virtual void RestoreFrustumContext (csFrustumContext* original) = 0;
00171 
00173   virtual void SetObjectFunction (csFrustumViewObjectFunc* func) = 0;
00175   virtual void CallObjectFunction (iMeshWrapper* mesh, bool vis) = 0;
00176 
00178   virtual float GetRadius () const = 0;
00180   virtual float GetSquaredRadius () const = 0;
00182   virtual bool CheckShadowMask (unsigned int mask) = 0;
00184   virtual bool CheckProcessMask (unsigned int mask) = 0;
00185 
00187   virtual void StartNewShadowBlock () = 0;
00188 
00190   virtual void SetUserdata (iFrustumViewUserdata* data) = 0;
00192   virtual iFrustumViewUserdata* GetUserdata () = 0;
00193 };
00194 
00197 #endif // __CS_IENGINE_FVIEW_H__
00198 

Generated for Crystal Space by doxygen 1.4.6