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_CRYSTALSPACE, 00064 CS_FOG_MODE_EXP, // Not implemented 00065 CS_FOG_MODE_EXP2 // Not implemented 00066 }; 00067 00071 struct csFog 00072 { 00074 float density; 00076 csColor4 color; 00078 float start; 00080 float end; 00082 float limit; 00084 csFogMode mode; 00085 00086 csFog() : density (0), color (0, 0, 0, 1.0f), start (0), end (0), limit (0), 00087 mode (CS_FOG_MODE_NONE) {} 00088 }; 00089 00098 struct iSectorCallback : public virtual iBase 00099 { 00100 SCF_INTERFACE (iSectorCallback, 0, 0, 1); 00101 00106 virtual void Traverse (iSector* sector, iBase* context) = 0; 00107 }; 00108 00116 struct iSectorMeshCallback : public virtual iBase 00117 { 00118 SCF_INTERFACE (iSectorMeshCallback, 0, 0, 1); 00119 00124 virtual void NewMesh (iSector* sector, iMeshWrapper* mesh) = 0; 00125 00129 virtual void RemoveMesh (iSector* sector, iMeshWrapper* mesh) = 0; 00130 }; 00131 00138 struct iLightVisibleCallback : public virtual iBase 00139 { 00140 SCF_INTERFACE (iLightVisibleCallback, 0, 0, 1); 00141 00143 virtual void LightVisible (iSector* sector, iLight* light) = 0; 00144 }; 00145 00149 struct csSectorHitBeamResult 00150 { 00152 iMeshWrapper* mesh; 00153 00155 csVector3 isect; 00156 00158 int polygon_idx; 00159 00164 iSector* final_sector; 00165 }; 00166 00190 struct iSector : public virtual iBase 00191 { 00192 SCF_INTERFACE(iSector,2,2,0); 00194 virtual iObject *QueryObject () = 0; 00195 00198 00199 virtual iMeshList* GetMeshes () = 0; 00200 00207 virtual csRenderMeshList* GetVisibleMeshes (iRenderView *) = 0; 00208 00215 virtual const csSet<csPtrKey<iMeshWrapper> >& GetPortalMeshes () const = 0; 00216 00223 virtual void UnlinkObjects () = 0; 00224 00229 virtual void AddSectorMeshCallback (iSectorMeshCallback* cb) = 0; 00230 00234 virtual void RemoveSectorMeshCallback (iSectorMeshCallback* cb) = 0; 00239 00240 virtual void Draw (iRenderView* rview) = 0; 00241 00246 virtual void PrepareDraw (iRenderView* rview) = 0; 00247 00251 virtual int GetRecLevel () const = 0; 00252 00256 virtual void IncRecLevel () = 0; 00257 00261 virtual void DecRecLevel () = 0; 00262 00267 virtual void SetRenderLoop (iRenderLoop* rl) = 0; 00268 00274 virtual iRenderLoop* GetRenderLoop () = 0; 00282 virtual iMeshGenerator* CreateMeshGenerator (const char* name) = 0; 00283 00287 virtual size_t GetMeshGeneratorCount () const = 0; 00288 00292 virtual iMeshGenerator* GetMeshGenerator (size_t idx) = 0; 00293 00297 virtual iMeshGenerator* GetMeshGeneratorByName (const char* name) = 0; 00298 00302 virtual void RemoveMeshGenerator (size_t idx) = 0; 00303 00307 virtual void RemoveMeshGenerators () = 0; 00312 00313 virtual bool HasFog () const = 0; 00315 virtual const csFog& GetFog () const = 0; 00317 virtual void SetFog (float density, const csColor& color) = 0; 00319 virtual void SetFog (const csFog& fog) = 0; 00321 virtual void DisableFog () = 0; 00329 virtual iLightList* GetLights () = 0; 00330 00332 virtual void ShineLights () = 0; 00334 virtual void ShineLights (iMeshWrapper*) = 0; 00335 00340 virtual void SetDynamicAmbientLight (const csColor& color) = 0; 00341 00343 virtual csColor GetDynamicAmbientLight () const = 0; 00344 00349 virtual uint GetDynamicAmbientVersion () const = 0; 00359 virtual void CalculateSectorBBox (csBox3& bbox, 00360 bool do_meshes) const = 0; 00361 00369 virtual bool SetVisibilityCullerPlugin (const char* name, 00370 iDocumentNode* culler_params = 0) = 0; 00376 virtual iVisibilityCuller* GetVisibilityCuller () = 0; 00377 00382 virtual void CheckFrustum (iFrustumView* lview) = 0; 00383 00393 virtual csSectorHitBeamResult HitBeamPortals (const csVector3& start, 00394 const csVector3& end) = 0; 00395 00404 virtual csSectorHitBeamResult HitBeam (const csVector3& start, 00405 const csVector3& end, bool accurate = false) = 0; 00406 00425 virtual iSector* FollowSegment (csReversibleTransform& t, 00426 csVector3& new_position, bool& mirror, bool only_portals = false) = 0; 00435 virtual void SetSectorCallback (iSectorCallback* cb) = 0; 00436 00440 virtual void RemoveSectorCallback (iSectorCallback* cb) = 0; 00441 00443 virtual int GetSectorCallbackCount () const = 0; 00444 00446 virtual iSectorCallback* GetSectorCallback (int idx) const = 0; 00459 virtual void SetLightCulling (bool enable) = 0; 00461 virtual bool IsLightCullingEnabled () const = 0; 00466 virtual void AddLightVisibleCallback (iLightVisibleCallback* cb) = 0; 00470 virtual void RemoveLightVisibleCallback (iLightVisibleCallback* cb) = 0; 00473 00474 virtual iShaderVariableContext* GetSVContext() = 0; 00475 00480 virtual void PrecacheDraw () = 0; 00481 }; 00482 00483 00494 struct iSectorList : public virtual iBase 00495 { 00496 SCF_INTERFACE(iSectorList, 2,0,0); 00498 virtual int GetCount () const = 0; 00499 00501 virtual iSector *Get (int n) const = 0; 00502 00504 virtual int Add (iSector *obj) = 0; 00505 00507 virtual bool Remove (iSector *obj) = 0; 00508 00510 virtual bool Remove (int n) = 0; 00511 00513 virtual void RemoveAll () = 0; 00514 00516 virtual int Find (iSector *obj) const = 0; 00517 00519 virtual iSector *FindByName (const char *Name) const = 0; 00520 }; 00521 00522 00530 struct iSectorIterator : public virtual iBase 00531 { 00532 SCF_INTERFACE(iSectorIterator,2,0,0); 00534 virtual bool HasNext () const = 0; 00535 00537 virtual iSector* Next () = 0; 00538 00543 virtual const csVector3& GetLastPosition () const = 0; 00544 00546 virtual void Reset () = 0; 00547 }; 00548 00551 #endif // __CS_IENGINE_SECTOR_H__
Generated for Crystal Space 1.4.0 by doxygen 1.5.8