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 00049 struct iObject; 00050 00051 struct iRenderView; 00052 struct iRenderLoop; 00053 struct iSector; 00054 struct iDocumentNode; 00055 00056 struct iShaderVariableContext; 00057 00058 class csBox3; 00059 class csRenderMeshList; 00060 class csReversibleTransform; 00061 class csVector3; 00062 00064 enum csFogMode 00065 { 00067 CS_FOG_MODE_NONE = 0, 00082 CS_FOG_MODE_LINEAR_CRYSTALSPACE, 00093 CS_FOG_MODE_CRYSTALSPACE, 00101 CS_FOG_MODE_EXP, 00109 CS_FOG_MODE_EXP2, 00111 CS_FOG_MODE_LINEAR = CS_FOG_MODE_LINEAR_CRYSTALSPACE 00112 }; 00113 00117 struct csFog 00118 { 00123 float density; 00125 csColor4 color; 00127 float start; 00129 float end; 00131 float limit; 00133 csFogMode mode; 00134 00135 csFog() : density (0), color (0, 0, 0, 1.0f), start (0), end (0), limit (0), 00136 mode (CS_FOG_MODE_NONE) {} 00137 }; 00138 00147 struct iSectorCallback : public virtual iBase 00148 { 00149 SCF_INTERFACE (iSectorCallback, 0, 0, 1); 00150 00155 virtual void Traverse (iSector* sector, iBase* context) = 0; 00156 }; 00157 00165 struct iSectorMeshCallback : public virtual iBase 00166 { 00167 SCF_INTERFACE (iSectorMeshCallback, 0, 0, 1); 00168 00173 virtual void NewMesh (iSector* sector, iMeshWrapper* mesh) = 0; 00174 00178 virtual void RemoveMesh (iSector* sector, iMeshWrapper* mesh) = 0; 00179 }; 00180 00187 struct iLightVisibleCallback : public virtual iBase 00188 { 00189 SCF_INTERFACE (iLightVisibleCallback, 0, 0, 1); 00190 00192 virtual void LightVisible (iSector* sector, iLight* light) = 0; 00193 }; 00194 00199 struct csSectorHitBeamResult 00200 { 00202 iMeshWrapper* mesh; 00203 00205 csVector3 isect; 00206 00208 int polygon_idx; 00209 00214 iSector* final_sector; 00215 }; 00216 00220 struct csSectorVisibleRenderMeshes 00221 { 00223 iMeshWrapper* imesh; 00225 int num; 00227 csRenderMesh** rmeshes; 00228 }; 00229 00253 struct iSector : public virtual iBase 00254 { 00255 SCF_INTERFACE(iSector,4,1,0); 00257 virtual iObject *QueryObject () = 0; 00258 00261 00262 virtual iMeshList* GetMeshes () = 0; 00263 00270 virtual csRenderMeshList* GetVisibleMeshes (iRenderView *) = 0; 00271 00278 virtual const csSet<csPtrKey<iMeshWrapper> >& GetPortalMeshes () const = 0; 00279 00286 virtual void UnlinkObjects () = 0; 00287 00292 virtual void AddSectorMeshCallback (iSectorMeshCallback* cb) = 0; 00293 00297 virtual void RemoveSectorMeshCallback (iSectorMeshCallback* cb) = 0; 00302 00303 virtual void Draw (iRenderView* rview) = 0; 00304 00309 virtual void PrepareDraw (iRenderView* rview) = 0; 00310 00314 virtual int GetRecLevel () const = 0; 00315 00319 virtual void IncRecLevel () = 0; 00320 00324 virtual void DecRecLevel () = 0; 00325 00330 THREADED_INTERFACE1(SetRenderLoop, iRenderLoop* rl); 00331 00337 virtual iRenderLoop* GetRenderLoop () = 0; 00345 virtual iMeshGenerator* CreateMeshGenerator (const char* name) = 0; 00346 00350 virtual size_t GetMeshGeneratorCount () const = 0; 00351 00355 virtual iMeshGenerator* GetMeshGenerator (size_t idx) = 0; 00356 00360 virtual iMeshGenerator* GetMeshGeneratorByName (const char* name) = 0; 00361 00365 virtual void RemoveMeshGenerator (size_t idx) = 0; 00366 00370 virtual void RemoveMeshGenerator (const char* name) = 0; 00371 00375 virtual void RemoveMeshGenerators () = 0; 00380 00381 virtual bool HasFog () const = 0; 00383 virtual const csFog& GetFog () const = 0; 00385 virtual void SetFog (float density, const csColor& color) = 0; 00387 virtual void SetFog (const csFog& fog) = 0; 00389 virtual void DisableFog () = 0; 00397 virtual iLightList* GetLights () = 0; 00398 00402 THREADED_INTERFACE1(AddLight, csRef<iLight> light); 00403 00408 virtual void SetDynamicAmbientLight (const csColor& color) = 0; 00409 00411 virtual csColor GetDynamicAmbientLight () const = 0; 00412 00417 virtual uint GetDynamicAmbientVersion () const = 0; 00427 virtual void CalculateSectorBBox (csBox3& bbox, 00428 bool do_meshes) const = 0; 00429 00439 virtual bool SetVisibilityCullerPlugin (const char* name, 00440 iDocumentNode* culler_params = 0) = 0; 00446 virtual iVisibilityCuller* GetVisibilityCuller () = 0; 00447 00458 virtual csSectorHitBeamResult HitBeamPortals (const csVector3& start, 00459 const csVector3& end) = 0; 00460 00470 virtual csSectorHitBeamResult HitBeam (const csVector3& start, 00471 const csVector3& end, bool accurate = false) = 0; 00472 00509 virtual iSector* FollowSegment (csReversibleTransform& t, 00510 csVector3& new_position, bool& mirror, bool only_portals = false, 00511 iPortal** crossed_portals = 0, iMeshWrapper** portal_meshes = 0, 00512 int firstIndex = 0, int* lastIndex = 0) = 0; 00521 THREADED_INTERFACE1(SetSectorCallback, csRef<iSectorCallback> cb); 00522 00526 THREADED_INTERFACE1(RemoveSectorCallback, csRef<iSectorCallback> cb); 00527 00529 virtual int GetSectorCallbackCount () const = 0; 00530 00532 virtual iSectorCallback* GetSectorCallback (int idx) const = 0; 00545 virtual void SetLightCulling (bool enable) = 0; 00547 virtual bool IsLightCullingEnabled () const = 0; 00552 virtual void AddLightVisibleCallback (iLightVisibleCallback* cb) = 0; 00556 virtual void RemoveLightVisibleCallback (iLightVisibleCallback* cb) = 0; 00559 00560 virtual iShaderVariableContext* GetSVContext() = 0; 00561 00566 virtual void PrecacheDraw () = 0; 00567 00571 virtual void CallSectorCallbacks (iRenderView* rview) = 0; 00572 00576 virtual csSectorVisibleRenderMeshes* GetVisibleRenderMeshes (int& num, 00577 iMeshWrapper* mesh, iRenderView *rview, uint32 frustum_mask) = 0; 00578 }; 00579 00580 00591 struct iSectorList : public virtual iBase 00592 { 00593 SCF_INTERFACE(iSectorList, 2,0,0); 00595 virtual int GetCount () const = 0; 00596 00598 virtual iSector *Get (int n) const = 0; 00599 00604 virtual int Add (iSector *obj) = 0; 00605 00610 virtual bool Remove (iSector *obj) = 0; 00611 00616 virtual bool Remove (int n) = 0; 00617 00619 virtual void RemoveAll () = 0; 00620 00626 virtual int Find (iSector *obj) const = 0; 00627 00632 virtual iSector *FindByName (const char *Name) const = 0; 00633 }; 00634 00635 00643 struct iSectorIterator : public virtual iBase 00644 { 00645 SCF_INTERFACE(iSectorIterator,2,0,0); 00647 virtual bool HasNext () const = 0; 00648 00653 virtual iSector* Next () = 0; 00654 00659 virtual const csVector3& GetLastPosition () const = 0; 00660 00662 virtual void Reset () = 0; 00663 }; 00664 00667 #endif // __CS_IENGINE_SECTOR_H__
Generated for Crystal Space 2.1 by doxygen 1.6.1
