| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# 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
    00043 struct iObject;
    00044
    00045 struct iRenderView;
    00046 struct iRenderLoop;
    00047 struct iFrustumView;
    00048 struct iSector;
    00049 struct iDocumentNode;
    00050
    00051 struct iShaderVariableContext;
    00052
    00053 class csBox3;
    00054 class csRenderMeshList;
    00055 class csReversibleTransform;
    00056 class csVector3;
    00057
    00058 enum csFogMode
    00059 {
    00060   CS_FOG_MODE_NONE = 0,
    00061   CS_FOG_MODE_LINEAR,
    00062   CS_FOG_MODE_EXP,
    00063   CS_FOG_MODE_EXP2,
    00064   CS_FOG_MODE_CRYSTALSPACE
    00065 };
    00066
    00070 struct csFog
    00071 {
    00073   float density;
    00075   csColor color;
    00077   float start;
    00079   float end;
    00081   csFogMode mode;
    00082
    00083   csFog() : density (0), color (0, 0, 0), start (0), end (0),
    00084     mode (CS_FOG_MODE_NONE) {}
    00085 };
    00086
    00095 struct iSectorCallback : public virtual iBase
    00096 {
    00097   SCF_INTERFACE (iSectorCallback, 0, 0, 1);
    00098
    00103   virtual void Traverse (iSector* sector, iBase* context) = 0;
    00104 };
    00105
    00113 struct iSectorMeshCallback : public virtual iBase
    00114 {
    00115   SCF_INTERFACE (iSectorMeshCallback, 0, 0, 1);
    00116
    00121   virtual void NewMesh (iSector* sector, iMeshWrapper* mesh) = 0;
    00122
    00126   virtual void RemoveMesh (iSector* sector, iMeshWrapper* mesh) = 0;
    00127 };
    00128
    00135 struct iLightVisibleCallback : public virtual iBase
    00136 {
    00137   SCF_INTERFACE (iLightVisibleCallback, 0, 0, 1);
    00138
    00140   virtual void LightVisible (iSector* sector, iLight* light) = 0;
    00141 };
    00142
    00146 struct csSectorHitBeamResult
    00147 {
    00149   iMeshWrapper* mesh;
    00150
    00152   csVector3 isect;
    00153
    00155   int polygon_idx;
    00156
    00161   iSector* final_sector;
    00162 };
    00163
    00187 struct iSector : public virtual iBase
    00188 {
    00189   SCF_INTERFACE(iSector,2,1,0);
    00191   virtual iObject *QueryObject () = 0;
    00192
    00195
    00196   virtual iMeshList* GetMeshes () = 0;
    00197
    00204   virtual csRenderMeshList* GetVisibleMeshes (iRenderView *) = 0;
    00205
    00212   virtual const csSet<csPtrKey<iMeshWrapper> >& GetPortalMeshes () const = 0;
    00213
    00220   virtual void UnlinkObjects () = 0;
    00221
    00226   virtual void AddSectorMeshCallback (iSectorMeshCallback* cb) = 0;
    00227
    00231   virtual void RemoveSectorMeshCallback (iSectorMeshCallback* cb) = 0;
    00236
    00237   virtual void Draw (iRenderView* rview) = 0;
    00238
    00243   virtual void PrepareDraw (iRenderView* rview) = 0;
    00244
    00248   virtual int GetRecLevel () const = 0;
    00249
    00253   virtual void IncRecLevel () = 0;
    00254
    00258   virtual void DecRecLevel () = 0;
    00259
    00264   virtual void SetRenderLoop (iRenderLoop* rl) = 0;
    00265
    00271   virtual iRenderLoop* GetRenderLoop () = 0;
    00279   virtual iMeshGenerator* CreateMeshGenerator (const char* name) = 0;
    00280
    00284   virtual size_t GetMeshGeneratorCount () const = 0;
    00285
    00289   virtual iMeshGenerator* GetMeshGenerator (size_t idx) = 0;
    00290
    00294   virtual iMeshGenerator* GetMeshGeneratorByName (const char* name) = 0;
    00295
    00299   virtual void RemoveMeshGenerator (size_t idx) = 0;
    00300
    00304   virtual void RemoveMeshGenerators () = 0;
    00309
    00310   virtual bool HasFog () const = 0;
    00312   virtual const csFog& GetFog () const = 0;
    00314   virtual void SetFog (float density, const csColor& color) = 0;
    00316   virtual void SetFog (const csFog& fog) = 0;
    00318   virtual void DisableFog () = 0;
    00326   virtual iLightList* GetLights () = 0;
    00327
    00329   virtual void ShineLights () = 0;
    00331   virtual void ShineLights (iMeshWrapper*) = 0;
    00332
    00337   virtual void SetDynamicAmbientLight (const csColor& color) = 0;
    00338
    00340   virtual csColor GetDynamicAmbientLight () const = 0;
    00341
    00346   virtual uint GetDynamicAmbientVersion () const = 0;
    00356   virtual void CalculateSectorBBox (csBox3& bbox,
    00357     bool do_meshes) const = 0;
    00358
    00366   virtual bool SetVisibilityCullerPlugin (const char* name,
    00367         iDocumentNode* culler_params = 0) = 0;
    00373   virtual iVisibilityCuller* GetVisibilityCuller () = 0;
    00374
    00379   virtual void CheckFrustum (iFrustumView* lview) = 0;
    00380
    00381
    00391   CS_DEPRECATED_METHOD_MSG("Use the csSectorHitBeamResult version instead")
    00392   virtual iMeshWrapper* HitBeamPortals (
    00393         const csVector3& start, const csVector3& end, csVector3& isect,
    00394         int* polygon_idx, iSector** final_sector = 0) = 0;
    00395
    00404   CS_DEPRECATED_METHOD_MSG("Use the csSectorHitBeamResult version instead")
    00405   virtual iMeshWrapper* HitBeam (const csVector3& start,
    00406         const csVector3& end, csVector3& intersect, int* polygon_idx,
    00407         bool accurate = false) = 0;
    00408
    00418   virtual csSectorHitBeamResult HitBeamPortals (const csVector3& start,
    00419         const csVector3& end) = 0;
    00420
    00429   virtual csSectorHitBeamResult HitBeam (const csVector3& start,
    00430         const csVector3& end, bool accurate = false) = 0;
    00431
    00450   virtual iSector* FollowSegment (csReversibleTransform& t,
    00451     csVector3& new_position, bool& mirror, bool only_portals = false) = 0;
    00460   virtual void SetSectorCallback (iSectorCallback* cb) = 0;
    00461
    00465   virtual void RemoveSectorCallback (iSectorCallback* cb) = 0;
    00466
    00468   virtual int GetSectorCallbackCount () const = 0;
    00469
    00471   virtual iSectorCallback* GetSectorCallback (int idx) const = 0;
    00484   virtual void SetLightCulling (bool enable) = 0;
    00486   virtual bool IsLightCullingEnabled () const = 0;
    00491   virtual void AddLightVisibleCallback (iLightVisibleCallback* cb) = 0;
    00495   virtual void RemoveLightVisibleCallback (iLightVisibleCallback* cb) = 0;
    00498
    00499   virtual iShaderVariableContext* GetSVContext() = 0;
    00500 };
    00501
    00502
    00513 struct iSectorList : public virtual iBase
    00514 {
    00515   SCF_INTERFACE(iSectorList, 2,0,0);
    00517   virtual int GetCount () const = 0;
    00518
    00520   virtual iSector *Get (int n) const = 0;
    00521
    00523   virtual int Add (iSector *obj) = 0;
    00524
    00526   virtual bool Remove (iSector *obj) = 0;
    00527
    00529   virtual bool Remove (int n) = 0;
    00530
    00532   virtual void RemoveAll () = 0;
    00533
    00535   virtual int Find (iSector *obj) const = 0;
    00536
    00538   virtual iSector *FindByName (const char *Name) const = 0;
    00539 };
    00540
    00541
    00549 struct iSectorIterator : public virtual iBase
    00550 {
    00551   SCF_INTERFACE(iSectorIterator,2,0,0);
    00553   virtual bool HasNext () const = 0;
    00554
    00556   virtual iSector* Next () = 0;
    00557
    00562   virtual const csVector3& GetLastPosition () const = 0;
    00563
    00565   virtual void Reset () = 0;
    00566 };
    00567
    00570 #endif // __CS_IENGINE_SECTOR_H__