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 "ivideo/rendermesh.h" 00032 00033 #include "csutil/cscolor.h" 00034 #include "csutil/scf.h" 00035 #include "csutil/set.h" 00036 #include "csgeom/vector3.h" 00037 #include "csgeom/aabbtree.h" 00038 00039 #include "iutil/threadmanager.h" 00040 00041 struct iMeshWrapper; 00042 struct iMeshGenerator; 00043 struct iMeshList; 00044 struct iLightList; 00045 struct iLight; 00046 struct iPortal; 00047 struct iVisibilityCuller; 00048 struct iMovable; 00049 00050 struct iObject; 00051 00052 struct iRenderView; 00053 struct iRenderLoop; 00054 struct iSector; 00055 struct iDocumentNode; 00056 00057 struct iShaderVariableContext; 00058 00059 class csBox3; 00060 class csRenderMeshList; 00061 class csReversibleTransform; 00062 class csVector3; 00063 00065 enum csFogMode 00066 { 00068 CS_FOG_MODE_NONE = 0, 00083 CS_FOG_MODE_LINEAR_CRYSTALSPACE, 00094 CS_FOG_MODE_CRYSTALSPACE, 00102 CS_FOG_MODE_EXP, 00110 CS_FOG_MODE_EXP2, 00112 CS_FOG_MODE_LINEAR = CS_FOG_MODE_LINEAR_CRYSTALSPACE 00113 }; 00114 00118 struct csFog 00119 { 00124 float density; 00126 csColor4 color; 00128 float start; 00130 float end; 00132 float limit; 00134 csFogMode mode; 00135 00136 csFog() : density (0), color (0, 0, 0, 1.0f), start (0), end (0), limit (0), 00137 mode (CS_FOG_MODE_NONE) {} 00138 }; 00139 00148 struct iSectorCallback : public virtual iBase 00149 { 00150 SCF_INTERFACE (iSectorCallback, 0, 0, 1); 00151 00156 virtual void Traverse (iSector* sector, iBase* context) = 0; 00157 }; 00158 00166 struct iSectorMeshCallback : public virtual iBase 00167 { 00168 SCF_INTERFACE (iSectorMeshCallback, 0, 0, 1); 00169 00174 virtual void NewMesh (iSector* sector, iMeshWrapper* mesh) = 0; 00175 00179 virtual void RemoveMesh (iSector* sector, iMeshWrapper* mesh) = 0; 00180 }; 00181 00188 struct iLightVisibleCallback : public virtual iBase 00189 { 00190 SCF_INTERFACE (iLightVisibleCallback, 0, 0, 1); 00191 00193 virtual void LightVisible (iSector* sector, iLight* light) = 0; 00194 }; 00195 00200 struct csSectorHitBeamResult 00201 { 00203 iMeshWrapper* mesh; 00204 00206 csVector3 isect; 00207 00209 int polygon_idx; 00210 00215 iSector* final_sector; 00216 }; 00217 00221 struct csSectorVisibleRenderMeshes 00222 { 00224 iMeshWrapper* imesh; 00226 int num; 00228 csRenderMesh** rmeshes; 00229 }; 00230 00254 struct iSector : public virtual iBase 00255 { 00256 SCF_INTERFACE(iSector,4,1,1); 00258 virtual iObject *QueryObject () = 0; 00259 00262 00263 virtual iMeshList* GetMeshes () = 0; 00264 00271 virtual csRenderMeshList* GetVisibleMeshes (iRenderView *) = 0; 00272 00279 virtual const csSet<csPtrKey<iMeshWrapper> >& GetPortalMeshes () const = 0; 00280 00287 virtual void UnlinkObjects () = 0; 00288 00293 virtual void AddSectorMeshCallback (iSectorMeshCallback* cb) = 0; 00294 00298 virtual void RemoveSectorMeshCallback (iSectorMeshCallback* cb) = 0; 00303 00304 virtual void Draw (iRenderView* rview) = 0; 00305 00310 virtual void PrepareDraw (iRenderView* rview) = 0; 00311 00315 virtual int GetRecLevel () const = 0; 00316 00320 virtual void IncRecLevel () = 0; 00321 00325 virtual void DecRecLevel () = 0; 00326 00331 THREADED_INTERFACE1(SetRenderLoop, iRenderLoop* rl); 00332 00338 virtual iRenderLoop* GetRenderLoop () = 0; 00346 virtual iMeshGenerator* CreateMeshGenerator (const char* name) = 0; 00347 00351 virtual size_t GetMeshGeneratorCount () const = 0; 00352 00356 virtual iMeshGenerator* GetMeshGenerator (size_t idx) = 0; 00357 00361 virtual iMeshGenerator* GetMeshGeneratorByName (const char* name) = 0; 00362 00366 virtual void RemoveMeshGenerator (size_t idx) = 0; 00367 00371 virtual void RemoveMeshGenerator (const char* name) = 0; 00372 00376 virtual void RemoveMeshGenerators () = 0; 00381 00382 virtual bool HasFog () const = 0; 00384 virtual const csFog& GetFog () const = 0; 00386 virtual void SetFog (float density, const csColor& color) = 0; 00388 virtual void SetFog (const csFog& fog) = 0; 00390 virtual void DisableFog () = 0; 00398 virtual iLightList* GetLights () = 0; 00399 00403 THREADED_INTERFACE1(AddLight, csRef<iLight> light); 00404 00409 virtual void SetDynamicAmbientLight (const csColor& color) = 0; 00410 00412 virtual csColor GetDynamicAmbientLight () const = 0; 00413 00418 virtual uint GetDynamicAmbientVersion () const = 0; 00428 virtual void CalculateSectorBBox (csBox3& bbox, 00429 bool do_meshes) const = 0; 00430 00440 virtual bool SetVisibilityCullerPlugin (const char* name, 00441 iDocumentNode* culler_params = 0) = 0; 00447 virtual iVisibilityCuller* GetVisibilityCuller () = 0; 00448 00461 virtual csSectorHitBeamResult HitBeamPortals (const csVector3& start, 00462 const csVector3& end, bool bf = false) = 0; 00463 00476 virtual csSectorHitBeamResult HitBeam (const csVector3& start, 00477 const csVector3& end, bool accurate = false, bool bf = false) = 0; 00478 00515 virtual iSector* FollowSegment (csReversibleTransform& t, 00516 csVector3& new_position, bool& mirror, bool only_portals = false, 00517 iPortal** crossed_portals = 0, iMeshWrapper** portal_meshes = 0, 00518 int firstIndex = 0, int* lastIndex = 0) = 0; 00527 THREADED_INTERFACE1(SetSectorCallback, csRef<iSectorCallback> cb); 00528 00532 THREADED_INTERFACE1(RemoveSectorCallback, csRef<iSectorCallback> cb); 00533 00535 virtual int GetSectorCallbackCount () const = 0; 00536 00538 virtual iSectorCallback* GetSectorCallback (int idx) const = 0; 00551 virtual void SetLightCulling (bool enable) = 0; 00553 virtual bool IsLightCullingEnabled () const = 0; 00558 virtual void AddLightVisibleCallback (iLightVisibleCallback* cb) = 0; 00562 virtual void RemoveLightVisibleCallback (iLightVisibleCallback* cb) = 0; 00565 00566 virtual iShaderVariableContext* GetSVContext() = 0; 00567 00572 virtual void PrecacheDraw () = 0; 00573 00577 virtual void CallSectorCallbacks (iRenderView* rview) = 0; 00578 00582 virtual csSectorVisibleRenderMeshes* GetVisibleRenderMeshes (int& num, 00583 iMeshWrapper* mesh, iRenderView *rview, uint32 frustum_mask) = 0; 00584 00590 virtual bool PrepareMovable (iMovable* movable) = 0; 00591 }; 00592 00593 00604 struct iSectorList : public virtual iBase 00605 { 00606 SCF_INTERFACE(iSectorList, 2,0,0); 00608 virtual int GetCount () const = 0; 00609 00611 virtual iSector *Get (int n) const = 0; 00612 00617 virtual int Add (iSector *obj) = 0; 00618 00623 virtual bool Remove (iSector *obj) = 0; 00624 00629 virtual bool Remove (int n) = 0; 00630 00632 virtual void RemoveAll () = 0; 00633 00639 virtual int Find (iSector *obj) const = 0; 00640 00645 virtual iSector *FindByName (const char *Name) const = 0; 00646 }; 00647 00648 00656 struct iSectorIterator : public virtual iBase 00657 { 00658 SCF_INTERFACE(iSectorIterator,2,0,0); 00660 virtual bool HasNext () const = 0; 00661 00666 virtual iSector* Next () = 0; 00667 00672 virtual const csVector3& GetLastPosition () const = 0; 00673 00675 virtual void Reset () = 0; 00676 }; 00677 00680 #endif // __CS_IENGINE_SECTOR_H__
Generated for Crystal Space 2.1 by doxygen 1.6.1
