CrystalSpace

Public API Reference

iengine/sector.h

Go to the documentation of this file.
00001 /*
00002     Crystal Space 3D engine
00003     Copyright (C) 1998-2001 by Jorrit Tyberghein
00004                   2004 by Marten Svanfeldt
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public
00017     License along with this library; if not, write to the Free
00018     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 */
00020 
00021 #ifndef __CS_IENGINE_SECTOR_H__
00022 #define __CS_IENGINE_SECTOR_H__
00023 
00031 #include "csutil/cscolor.h"
00032 #include "csutil/scf.h"
00033 #include "csutil/set.h"
00034 #include "csgeom/vector3.h"
00035 
00036 struct iMeshWrapper;
00037 struct iMeshGenerator;
00038 struct iMeshList;
00039 struct iLightList;
00040 struct iLight;
00041 struct iVisibilityCuller;
00042 struct iLightSectorInfluence;
00043 
00044 struct iObject;
00045 
00046 struct iRenderView;
00047 struct iRenderLoop;
00048 struct iFrustumView;
00049 struct iSector;
00050 struct iDocumentNode;
00051 
00052 struct iShaderVariableContext;
00053 
00054 class csBox3;
00055 class csRenderMeshList;
00056 class csReversibleTransform;
00057 class csVector3;
00058 
00059 enum csFogMode
00060 {
00061   CS_FOG_MODE_NONE = 0,
00062   CS_FOG_MODE_LINEAR,
00063   CS_FOG_MODE_EXP,
00064   CS_FOG_MODE_EXP2,
00065   CS_FOG_MODE_CRYSTALSPACE
00066 };
00067 
00071 struct csFog
00072 {
00074   float density;
00076   csColor color;
00078   float start;
00080   float end;
00082   csFogMode mode;
00083 
00084   csFog() : density (0), color (0, 0, 0), start (0), end (0), 
00085     mode (CS_FOG_MODE_NONE) {}
00086 };
00087 
00096 struct iSectorCallback : public virtual iBase
00097 {
00098   SCF_INTERFACE (iSectorCallback, 0, 0, 1);
00099 
00104   virtual void Traverse (iSector* sector, iBase* context) = 0;
00105 };
00106 
00114 struct iSectorMeshCallback : public virtual iBase
00115 {
00116   SCF_INTERFACE (iSectorMeshCallback, 0, 0, 1);
00117 
00122   virtual void NewMesh (iSector* sector, iMeshWrapper* mesh) = 0;
00123 
00127   virtual void RemoveMesh (iSector* sector, iMeshWrapper* mesh) = 0;
00128 };
00129 
00136 struct iLightVisibleCallback : public virtual iBase
00137 {
00138   SCF_INTERFACE (iLightVisibleCallback, 0, 0, 1);
00139 
00141   virtual void LightVisible (iSector* sector, iLight* light) = 0;
00142 };
00143 
00147 struct csSectorHitBeamResult
00148 {
00150   iMeshWrapper* mesh;
00151 
00153   csVector3 isect;
00154 
00156   int polygon_idx;
00157 
00162   iSector* final_sector;
00163 };
00164 
00188 struct iSector : public virtual iBase
00189 {
00190   SCF_INTERFACE(iSector,2,2,0);
00192   virtual iObject *QueryObject () = 0;
00193 
00196 
00197   virtual iMeshList* GetMeshes () = 0;
00198 
00205   virtual csRenderMeshList* GetVisibleMeshes (iRenderView *) = 0;
00206 
00213   virtual const csSet<csPtrKey<iMeshWrapper> >& GetPortalMeshes () const = 0;
00214 
00221   virtual void UnlinkObjects () = 0;
00222 
00227   virtual void AddSectorMeshCallback (iSectorMeshCallback* cb) = 0;
00228 
00232   virtual void RemoveSectorMeshCallback (iSectorMeshCallback* cb) = 0;
00237 
00238   virtual void Draw (iRenderView* rview) = 0;
00239 
00244   virtual void PrepareDraw (iRenderView* rview) = 0;
00245 
00249   virtual int GetRecLevel () const = 0;
00250 
00254   virtual void IncRecLevel () = 0;
00255 
00259   virtual void DecRecLevel () = 0;
00260 
00265   virtual void SetRenderLoop (iRenderLoop* rl) = 0;
00266 
00272   virtual iRenderLoop* GetRenderLoop () = 0;
00280   virtual iMeshGenerator* CreateMeshGenerator (const char* name) = 0;
00281 
00285   virtual size_t GetMeshGeneratorCount () const = 0;
00286 
00290   virtual iMeshGenerator* GetMeshGenerator (size_t idx) = 0;
00291 
00295   virtual iMeshGenerator* GetMeshGeneratorByName (const char* name) = 0;
00296 
00300   virtual void RemoveMeshGenerator (size_t idx) = 0;
00301 
00305   virtual void RemoveMeshGenerators () = 0;
00310 
00311   virtual bool HasFog () const = 0;
00313   virtual const csFog& GetFog () const = 0;
00315   virtual void SetFog (float density, const csColor& color) = 0;
00317   virtual void SetFog (const csFog& fog) = 0;
00319   virtual void DisableFog () = 0;
00327   virtual iLightList* GetLights () = 0;
00328 
00330   virtual void ShineLights () = 0;
00332   virtual void ShineLights (iMeshWrapper*) = 0;
00333 
00338   virtual void SetDynamicAmbientLight (const csColor& color) = 0;
00339 
00341   virtual csColor GetDynamicAmbientLight () const = 0;
00342 
00347   virtual uint GetDynamicAmbientVersion () const = 0;
00357   virtual void CalculateSectorBBox (csBox3& bbox,
00358     bool do_meshes) const = 0;
00359 
00367   virtual bool SetVisibilityCullerPlugin (const char* name,
00368         iDocumentNode* culler_params = 0) = 0;
00374   virtual iVisibilityCuller* GetVisibilityCuller () = 0;
00375 
00380   virtual void CheckFrustum (iFrustumView* lview) = 0;  
00381 
00391   virtual csSectorHitBeamResult HitBeamPortals (const csVector3& start,
00392         const csVector3& end) = 0;
00393 
00402   virtual csSectorHitBeamResult HitBeam (const csVector3& start,
00403         const csVector3& end, bool accurate = false) = 0;
00404 
00423   virtual iSector* FollowSegment (csReversibleTransform& t,
00424     csVector3& new_position, bool& mirror, bool only_portals = false) = 0;
00433   virtual void SetSectorCallback (iSectorCallback* cb) = 0;
00434 
00438   virtual void RemoveSectorCallback (iSectorCallback* cb) = 0;
00439 
00441   virtual int GetSectorCallbackCount () const = 0;
00442 
00444   virtual iSectorCallback* GetSectorCallback (int idx) const = 0;
00457   virtual void SetLightCulling (bool enable) = 0;
00459   virtual bool IsLightCullingEnabled () const = 0;
00464   virtual void AddLightVisibleCallback (iLightVisibleCallback* cb) = 0;
00468   virtual void RemoveLightVisibleCallback (iLightVisibleCallback* cb) = 0;
00471 
00472   virtual iShaderVariableContext* GetSVContext() = 0;
00473 
00478   virtual void PrecacheDraw () = 0;
00479 };
00480 
00481 
00492 struct iSectorList : public virtual iBase
00493 {
00494   SCF_INTERFACE(iSectorList, 2,0,0);
00496   virtual int GetCount () const = 0;
00497 
00499   virtual iSector *Get (int n) const = 0;
00500 
00502   virtual int Add (iSector *obj) = 0;
00503 
00505   virtual bool Remove (iSector *obj) = 0;
00506 
00508   virtual bool Remove (int n) = 0;
00509 
00511   virtual void RemoveAll () = 0;
00512 
00514   virtual int Find (iSector *obj) const = 0;
00515 
00517   virtual iSector *FindByName (const char *Name) const = 0;
00518 };
00519 
00520 
00528 struct iSectorIterator : public virtual iBase
00529 {
00530   SCF_INTERFACE(iSectorIterator,2,0,0);
00532   virtual bool HasNext () const = 0;
00533 
00535   virtual iSector* Next () = 0;
00536 
00541   virtual const csVector3& GetLastPosition () const = 0;
00542 
00544   virtual void Reset () = 0;
00545 };
00546 
00549 #endif // __CS_IENGINE_SECTOR_H__

Generated for Crystal Space 1.2.1 by doxygen 1.5.3