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/scf.h"
00032 #include "csutil/set.h"
00033 
00034 struct iMeshWrapper;
00035 struct iMeshGenerator;
00036 struct iMeshList;
00037 struct iLightList;
00038 struct iLight;
00039 struct iVisibilityCuller;
00040 
00041 struct iObject;
00042 
00043 struct iRenderView;
00044 struct iRenderLoop;
00045 struct iFrustumView;
00046 struct iSector;
00047 struct iDocumentNode;
00048 
00049 class csBox3;
00050 class csColor;
00051 class csRenderMeshList;
00052 class csReversibleTransform;
00053 class csVector3;
00054 
00055 enum csFogMode
00056 {
00057   CS_FOG_MODE_NONE = 0,
00058   CS_FOG_MODE_LINEAR,
00059   CS_FOG_MODE_EXP,
00060   CS_FOG_MODE_EXP2
00061 };
00062 
00066 struct csFog
00067 {
00069   bool enabled;
00071   float density;
00073   float red;
00075   float green;
00077   float blue;
00079   float start;
00081   float end;
00083   csFogMode mode;
00084 };
00085 
00091 struct iSectorCallback : public virtual iBase
00092 {
00093   SCF_INTERFACE (iSectorCallback, 0, 0, 1);
00094 
00099   virtual void Traverse (iSector* sector, iBase* context) = 0;
00100 };
00101 
00106 struct iSectorMeshCallback : public virtual iBase
00107 {
00108   SCF_INTERFACE (iSectorMeshCallback, 0, 0, 1);
00109 
00114   virtual void NewMesh (iSector* sector, iMeshWrapper* mesh) = 0;
00115 
00119   virtual void RemoveMesh (iSector* sector, iMeshWrapper* mesh) = 0;
00120 };
00121 
00125 struct iLightVisibleCallback : public virtual iBase
00126 {
00127   SCF_INTERFACE (iLightVisibleCallback, 0, 0, 1);
00128 
00130   virtual void LightVisible (iSector* sector, iLight* light) = 0;
00131 };
00132 
00156 struct iSector : public virtual iBase
00157 {
00158   SCF_INTERFACE(iSector,2,0,0);
00160   virtual iObject *QueryObject () = 0;
00161 
00164 
00165   virtual iMeshList* GetMeshes () = 0;
00166 
00173   virtual csRenderMeshList* GetVisibleMeshes (iRenderView *) = 0;
00174 
00181   virtual const csSet<csPtrKey<iMeshWrapper> >& GetPortalMeshes () const = 0;
00185   virtual void RegisterPortalMesh (iMeshWrapper* mesh) = 0;
00189   virtual void UnregisterPortalMesh (iMeshWrapper* mesh) = 0;
00190 
00197   virtual void UnlinkObjects () = 0;
00198 
00203   virtual void AddSectorMeshCallback (iSectorMeshCallback* cb) = 0;
00204 
00208   virtual void RemoveSectorMeshCallback (iSectorMeshCallback* cb) = 0;
00213 
00214   virtual void Draw (iRenderView* rview) = 0;
00215 
00220   virtual void PrepareDraw (iRenderView* rview) = 0;
00221 
00225   virtual int GetRecLevel () const = 0;
00226 
00230   virtual void IncRecLevel () = 0;
00231 
00235   virtual void DecRecLevel () = 0;
00236 
00241   virtual void SetRenderLoop (iRenderLoop* rl) = 0;
00242 
00248   virtual iRenderLoop* GetRenderLoop () = 0;
00256   virtual iMeshGenerator* CreateMeshGenerator (const char* name) = 0;
00257 
00261   virtual size_t GetMeshGeneratorCount () const = 0;
00262 
00266   virtual iMeshGenerator* GetMeshGenerator (size_t idx) = 0;
00267 
00271   virtual iMeshGenerator* GetMeshGeneratorByName (const char* name) = 0;
00272 
00276   virtual void RemoveMeshGenerator (size_t idx) = 0;
00277 
00281   virtual void RemoveMeshGenerators () = 0;
00286 
00287   virtual bool HasFog () const = 0;
00289   virtual csFog *GetFog () const = 0;
00291   virtual void SetFog (float density, const csColor& color) = 0;
00293   virtual void DisableFog () = 0;
00301   virtual iLightList* GetLights () = 0;
00302 
00304   virtual void ShineLights () = 0;
00306   virtual void ShineLights (iMeshWrapper*) = 0;
00307 
00312   virtual void SetDynamicAmbientLight (const csColor& color) = 0;
00313 
00315   virtual csColor GetDynamicAmbientLight () const = 0;
00316 
00321   virtual uint GetDynamicAmbientVersion () const = 0;
00331   virtual void CalculateSectorBBox (csBox3& bbox,
00332     bool do_meshes) const = 0;
00333 
00341   virtual bool SetVisibilityCullerPlugin (const char* name,
00342         iDocumentNode* culler_params = 0) = 0;
00348   virtual iVisibilityCuller* GetVisibilityCuller () = 0;
00349 
00354   virtual void CheckFrustum (iFrustumView* lview) = 0;
00355 
00356   
00365   virtual iMeshWrapper* HitBeamPortals (const csVector3& start,
00366         const csVector3& end, csVector3& isect, int* polygon_idx) = 0;
00367 
00375   virtual iMeshWrapper* HitBeam (const csVector3& start, const csVector3& end,
00376     csVector3& intersect, int* polygon_idx, bool accurate = false) = 0;
00377 
00396   virtual iSector* FollowSegment (csReversibleTransform& t,
00397     csVector3& new_position, bool& mirror, bool only_portals = false) = 0;
00406   virtual void SetSectorCallback (iSectorCallback* cb) = 0;
00407 
00411   virtual void RemoveSectorCallback (iSectorCallback* cb) = 0;
00412 
00414   virtual int GetSectorCallbackCount () const = 0;
00415 
00417   virtual iSectorCallback* GetSectorCallback (int idx) const = 0;
00418 
00427   virtual void SetLightCulling (bool enable) = 0;
00429   virtual bool IsLightCullingEnabled () const = 0;
00434   virtual void AddLightVisibleCallback (iLightVisibleCallback* cb) = 0;
00438   virtual void RemoveLightVisibleCallback (iLightVisibleCallback* cb) = 0;
00440 };
00441 
00442 
00453 struct iSectorList : public virtual iBase
00454 {
00455   SCF_INTERFACE(iSectorList, 2,0,0);
00457   virtual int GetCount () const = 0;
00458 
00460   virtual iSector *Get (int n) const = 0;
00461 
00463   virtual int Add (iSector *obj) = 0;
00464 
00466   virtual bool Remove (iSector *obj) = 0;
00467 
00469   virtual bool Remove (int n) = 0;
00470 
00472   virtual void RemoveAll () = 0;
00473 
00475   virtual int Find (iSector *obj) const = 0;
00476 
00478   virtual iSector *FindByName (const char *Name) const = 0;
00479 };
00480 
00481 
00489 struct iSectorIterator : public virtual iBase
00490 {
00491   SCF_INTERFACE(iSectorIterator,2,0,0);
00493   virtual bool HasNext () = 0;
00494 
00496   virtual iSector* Next () = 0;
00497 
00502   virtual const csVector3& GetLastPosition () = 0;
00503 
00505   virtual void Reset () = 0;
00506 };
00507 
00510 #endif // __CS_IENGINE_SECTOR_H__

Generated for Crystal Space by doxygen 1.4.6