CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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 
00030 #include "csutil/scf.h"
00031 #include "csutil/set.h"
00032 
00033 struct iMeshWrapper;
00034 struct iMeshList;
00035 struct iLightList;
00036 struct iLight;
00037 struct iVisibilityCuller;
00038 
00039 struct iObject;
00040 struct csFog;
00041 
00042 struct iRenderView;
00043 struct iRenderLoop;
00044 struct iFrustumView;
00045 struct iSector;
00046 struct iDocumentNode;
00047 
00048 class csBox3;
00049 class csColor;
00050 class csRenderMeshList;
00051 class csReversibleTransform;
00052 class csVector3;
00053 
00054 SCF_VERSION (iSectorCallback, 0, 0, 1);
00055 
00061 struct iSectorCallback : public iBase
00062 {
00067   virtual void Traverse (iSector* sector, iBase* context) = 0;
00068 };
00069 
00070 SCF_VERSION (iSectorMeshCallback, 0, 0, 1);
00071 
00076 struct iSectorMeshCallback : public iBase
00077 {
00082   virtual void NewMesh (iSector* sector, iMeshWrapper* mesh) = 0;
00083 
00087   virtual void RemoveMesh (iSector* sector, iMeshWrapper* mesh) = 0;
00088 };
00089 
00117 struct iSector : public virtual iBase
00118 {
00119   SCF_INTERFACE(iSector,2,0,0);
00121   virtual iObject *QueryObject () = 0;
00122 
00123   // -- Mesh handling
00124 
00126   virtual iMeshList* GetMeshes () = 0;
00127 
00134   virtual csRenderMeshList* GetVisibleMeshes (iRenderView *) = 0;
00135 
00142   virtual const csSet<csPtrKey<iMeshWrapper> >& GetPortalMeshes () const = 0;
00146   virtual void RegisterPortalMesh (iMeshWrapper* mesh) = 0;
00150   virtual void UnregisterPortalMesh (iMeshWrapper* mesh) = 0;
00151 
00158   virtual void UnlinkObjects () = 0;
00159 
00164   virtual void AddSectorMeshCallback (iSectorMeshCallback* cb) = 0;
00165 
00169   virtual void RemoveSectorMeshCallback (iSectorMeshCallback* cb) = 0;
00170 
00171   // -- Drawing related
00172   
00174   virtual void Draw (iRenderView* rview) = 0;
00175 
00180   virtual void PrepareDraw (iRenderView* rview) = 0;
00181 
00185   virtual int GetRecLevel () const = 0;
00186 
00190   virtual void IncRecLevel () = 0;
00191 
00195   virtual void DecRecLevel () = 0;
00196 
00201   virtual void SetRenderLoop (iRenderLoop* rl) = 0;
00202 
00208   virtual iRenderLoop* GetRenderLoop () = 0;
00209 
00210   // -- Fog handling
00211 
00213   virtual bool HasFog () const = 0;
00215   virtual csFog *GetFog () const = 0;
00217   virtual void SetFog (float density, const csColor& color) = 0;
00219   virtual void DisableFog () = 0;
00220 
00221   // -- Light handling
00222 
00226   virtual iLightList* GetLights () = 0;
00227 
00229   virtual void ShineLights () = 0;
00231   virtual void ShineLights (iMeshWrapper*) = 0;
00232 
00237   virtual void SetDynamicAmbientLight (const csColor& color) = 0;
00238 
00240   virtual csColor GetDynamicAmbientLight () const = 0;
00241 
00246   virtual uint GetDynamicAmbientVersion () const = 0;
00247 
00248   // -- Visculling
00249 
00255   virtual void CalculateSectorBBox (csBox3& bbox,
00256     bool do_meshes) const = 0;
00257 
00265   virtual bool SetVisibilityCullerPlugin (const char* name,
00266         iDocumentNode* culler_params = 0) = 0;
00272   virtual iVisibilityCuller* GetVisibilityCuller () = 0;
00273 
00278   virtual void CheckFrustum (iFrustumView* lview) = 0;
00279 
00280   
00289   virtual iMeshWrapper* HitBeamPortals (const csVector3& start,
00290         const csVector3& end, csVector3& isect, int* polygon_idx) = 0;
00291 
00299   virtual iMeshWrapper* HitBeam (const csVector3& start, const csVector3& end,
00300     csVector3& intersect, int* polygon_idx, bool accurate = false) = 0;
00301 
00320   virtual iSector* FollowSegment (csReversibleTransform& t,
00321     csVector3& new_position, bool& mirror, bool only_portals = false) = 0;
00322 
00323   // -- Various  
00324 
00329   virtual void SetSectorCallback (iSectorCallback* cb) = 0;
00330 
00334   virtual void RemoveSectorCallback (iSectorCallback* cb) = 0;
00335 
00337   virtual int GetSectorCallbackCount () const = 0;
00338 
00340   virtual iSectorCallback* GetSectorCallback (int idx) const = 0;
00341 };
00342 
00343 
00344 SCF_VERSION (iSectorList, 0, 0, 2);
00345 
00359 struct iSectorList : public iBase
00360 {
00362   virtual int GetCount () const = 0;
00363 
00365   virtual iSector *Get (int n) const = 0;
00366 
00368   virtual int Add (iSector *obj) = 0;
00369 
00371   virtual bool Remove (iSector *obj) = 0;
00372 
00374   virtual bool Remove (int n) = 0;
00375 
00377   virtual void RemoveAll () = 0;
00378 
00380   virtual int Find (iSector *obj) const = 0;
00381 
00383   virtual iSector *FindByName (const char *Name) const = 0;
00384 };
00385 
00386 SCF_VERSION (iSectorIterator, 0, 1, 0);
00387 
00397 struct iSectorIterator : public iBase
00398 {
00400   virtual bool HasNext () = 0;
00401 
00403   virtual iSector* Next () = 0;
00404 
00409   virtual const csVector3& GetLastPosition () = 0;
00410 
00412   virtual void Reset () = 0;
00413 };
00414 
00417 #endif // __CS_IENGINE_SECTOR_H__

Generated for Crystal Space by doxygen 1.4.4