iengine/engine.h
Go to the documentation of this file.00001 /* 00002 Crystal Space 3D Engine 00003 Copyright (C) 1998-2002 by Jorrit Tyberghein 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_IENGINE_ENGINE_H__ 00021 #define __CS_IENGINE_ENGINE_H__ 00022 00031 #include "csutil/scf_interface.h" 00032 00033 #include "csgeom/vector3.h" 00034 00035 #include "iengine/light.h" 00036 00037 class csBox3; 00038 class csColor; 00039 class csFrustum; 00040 00041 struct iCacheManager; 00042 struct iCamera; 00043 struct iCameraPosition; 00044 struct iCameraPositionList; 00045 struct iClipper2D; 00046 struct iDataBuffer; 00047 struct iFrustumView; 00048 struct iLight; 00049 struct iLightIterator; 00050 struct iLoaderContext; 00051 struct iMaterial; 00052 struct iMaterialList; 00053 struct iMaterialWrapper; 00054 struct iMeshFactoryList; 00055 struct iMeshFactoryWrapper; 00056 struct iMeshList; 00057 struct iMeshObject; 00058 struct iMeshObjectFactory; 00059 struct iMeshObjectType; 00060 struct iMeshWrapper; 00061 struct iMeshWrapperIterator; 00062 struct iObject; 00063 struct iObjectIterator; 00064 struct iObjectWatcher; 00065 struct iPortal; 00066 struct iProgressMeter; 00067 struct iRegion; 00068 struct iRegionList; 00069 struct iRenderLoop; 00070 struct iRenderLoopManager; 00071 struct iRenderView; 00072 struct iSector; 00073 struct iSectorIterator; 00074 struct iSectorList; 00075 struct iSharedVariableList; 00076 struct iTextureHandle; 00077 struct iTextureList; 00078 struct iTextureWrapper; 00079 00080 struct iEngine; 00081 00087 #define CS_ENGINE_CACHE_READ 1 00088 00092 #define CS_ENGINE_CACHE_WRITE 2 00093 00097 #define CS_ENGINE_CACHE_NOUPDATE 4 00098 00102 enum csRenderPrioritySorting 00103 { 00107 CS_RENDPRI_SORT_NONE = 0, 00108 00112 CS_RENDPRI_SORT_BACK2FRONT = 1, 00113 00117 CS_RENDPRI_SORT_FRONT2BACK = 2 00118 }; 00129 struct iEngineFrameCallback : public virtual iBase 00130 { 00131 SCF_INTERFACE(iEngineFrameCallback,1,0,0); 00135 virtual void StartFrame (iEngine* engine, iRenderView* rview) = 0; 00136 }; 00137 00145 struct iEngineSectorCallback : public virtual iBase 00146 { 00147 SCF_INTERFACE(iEngineSectorCallback,2,0,0); 00151 virtual void NewSector (iEngine* engine, iSector* sector) = 0; 00152 00156 virtual void RemoveSector (iEngine* engine, iSector* sector) = 0; 00157 }; 00158 00159 00174 struct iEngine : public virtual iBase 00175 { 00176 SCF_INTERFACE(iEngine,2,1,0); 00177 00179 virtual iObject *QueryObject() = 0; 00180 00201 virtual bool Prepare (iProgressMeter* meter = 0) = 0; 00202 00210 virtual void PrepareTextures () = 0; 00211 00217 virtual void PrepareMeshes () = 0; 00218 00234 virtual void ForceRelight (iRegion* region = 0, 00235 iProgressMeter* meter = 0) = 0; 00236 00249 virtual void ForceRelight (iLight* light, iRegion* region = 0) = 0; 00250 00261 virtual void ShineLights (iRegion* region = 0, 00262 iProgressMeter* meter = 0) = 0; 00263 00276 virtual void SetLightingCacheMode (int mode) = 0; 00277 00279 virtual int GetLightingCacheMode () = 0; 00280 00293 virtual void SetCacheManager (iCacheManager* cache_mgr) = 0; 00294 00301 virtual void SetVFSCacheManager (const char* vfspath = 0) = 0; 00302 00306 virtual iCacheManager* GetCacheManager () = 0; 00307 00314 virtual void SetMaxLightmapSize (int w, int h) = 0; 00315 00320 virtual void GetMaxLightmapSize (int& w, int& h) = 0; 00321 00326 virtual void GetDefaultMaxLightmapSize (int& w, int& h) = 0; 00327 00329 virtual int GetMaxLightmapAspectRatio () const = 0; 00330 00368 virtual void RegisterRenderPriority (const char* name, long priority, 00369 csRenderPrioritySorting rendsort = CS_RENDPRI_SORT_NONE) = 0; 00370 00377 virtual long GetRenderPriority (const char* name) const = 0; 00379 virtual csRenderPrioritySorting GetRenderPrioritySorting ( 00380 const char* name) const = 0; 00382 virtual csRenderPrioritySorting GetRenderPrioritySorting ( 00383 long priority) const = 0; 00385 virtual long GetSkyRenderPriority () = 0; 00387 virtual long GetPortalRenderPriority () = 0; 00389 virtual long GetWallRenderPriority () = 0; 00391 virtual long GetObjectRenderPriority () = 0; 00393 virtual long GetAlphaRenderPriority () = 0; 00395 virtual void ClearRenderPriorities () = 0; 00397 virtual int GetRenderPriorityCount () const = 0; 00399 virtual const char* GetRenderPriorityName (long priority) const = 0; 00400 00415 virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt) = 0; 00416 00422 virtual iMaterialWrapper* CreateMaterial (const char *name, 00423 iTextureWrapper* texture) = 0; 00424 00426 virtual iMaterialList* GetMaterialList () const = 0; 00427 00440 virtual iMaterialWrapper* FindMaterial (const char* name, 00441 iRegion* region = 0) = 0; 00442 00464 virtual iTextureWrapper* CreateTexture (const char *name, 00465 const char *fileName, csColor *transp, int flags) = 0; 00466 00477 virtual iTextureWrapper* CreateBlackTexture (const char *name, 00478 int w, int h, csColor *transp, int flags) = 0; 00479 00484 virtual int GetTextureFormat () const = 0; 00485 00487 virtual iTextureList* GetTextureList () const = 0; 00488 00501 virtual iTextureWrapper* FindTexture (const char* name, 00502 iRegion* region = 0) = 0; 00503 00530 virtual csPtr<iLight> CreateLight (const char* name, const csVector3& pos, 00531 float radius, const csColor& color, 00532 csLightDynamicType dyntype = CS_LIGHT_DYNAMICTYPE_STATIC) = 0; 00533 00538 virtual iLight* FindLight (const char *Name, bool RegionOnly = false) 00539 const = 0; 00540 00545 virtual iLight* FindLightID (const char* light_id) const = 0; 00546 00553 virtual csPtr<iLightIterator> GetLightIterator (iRegion* region = 0) = 0; 00554 00565 virtual void RemoveLight (iLight* light) = 0; 00566 00571 virtual void SetAmbientLight (const csColor &) = 0; 00573 virtual void GetAmbientLight (csColor &) const = 0; 00575 virtual void GetDefaultAmbientLight (csColor &c) const = 0; 00576 00588 virtual int GetNearbyLights (iSector* sector, const csVector3& pos, 00589 iLight** lights, int max_num_lights) = 0; 00590 00602 virtual int GetNearbyLights (iSector* sector, const csBox3& box, 00603 iLight** lights, int max_num_lights) = 0; 00604 00614 virtual iSector *CreateSector (const char *name) = 0; 00615 00617 virtual iSectorList* GetSectors () = 0; 00618 00631 virtual iSector* FindSector (const char* name, 00632 iRegion* region = 0) = 0; 00633 00642 virtual csPtr<iSectorIterator> GetNearbySectors (iSector* sector, 00643 const csVector3& pos, float radius) = 0; 00644 00653 virtual csPtr<iSectorIterator> GetNearbySectors (iSector* sector, 00654 const csBox3& box) = 0; 00655 00660 virtual void AddEngineFrameCallback (iEngineFrameCallback* cb) = 0; 00661 00665 virtual void RemoveEngineFrameCallback (iEngineFrameCallback* cb) = 0; 00666 00671 virtual void AddEngineSectorCallback (iEngineSectorCallback* cb) = 0; 00672 00676 virtual void RemoveEngineSectorCallback (iEngineSectorCallback* cb) = 0; 00677 00696 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshFactoryWrapper* factory, 00697 const char* name, iSector* sector = 0, 00698 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00699 00712 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshObject* meshobj, 00713 const char* name, iSector* sector = 0, 00714 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00715 00735 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* classid, 00736 const char* name, iSector* sector = 0, 00737 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00738 00743 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* name) = 0; 00744 00755 virtual csPtr<iMeshWrapper> CreateSectorWallsMesh (iSector* sector, 00756 const char* name) = 0; 00757 00767 virtual csPtr<iMeshWrapper> CreateThingMesh (iSector* sector, 00768 const char* name) = 0; 00769 00784 virtual csPtr<iMeshWrapper> LoadMeshWrapper ( 00785 const char* name, const char* loaderClassId, 00786 iDataBuffer* input, iSector* sector, const csVector3& pos) = 0; 00787 00792 virtual void AddMeshAndChildren (iMeshWrapper* mesh) = 0; 00793 00800 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 00801 const csVector3& pos, float radius, bool crossPortals = true) = 0; 00802 00810 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 00811 const csBox3& box, bool crossPortals = true) = 0; 00812 00820 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 00821 const csVector3& start, const csVector3& end, 00822 bool crossPortals = true) = 0; 00823 00825 virtual iMeshList* GetMeshes () = 0; 00826 00839 virtual iMeshWrapper* FindMeshObject (const char* name, 00840 iRegion* region = 0) = 0; 00841 00848 virtual void WantToDie (iMeshWrapper* mesh) = 0; 00849 00868 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* classId, 00869 const char* name) = 0; 00870 00878 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory ( 00879 iMeshObjectFactory * factory, const char* name) = 0; 00880 00886 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* name) = 0; 00887 00895 virtual csPtr<iMeshFactoryWrapper> LoadMeshFactory ( 00896 const char* name, const char* loaderClassId, 00897 iDataBuffer* input) = 0; 00898 00911 virtual iMeshFactoryWrapper* FindMeshFactory (const char* name, 00912 iRegion* region = 0) = 0; 00913 00915 virtual iMeshFactoryList* GetMeshFactories () = 0; 00916 00929 virtual iRegion* CreateRegion (const char* name) = 0; 00931 virtual iRegionList* GetRegions () = 0; 00932 00942 virtual csPtr<iCamera> CreateCamera () = 0; 00943 00956 virtual iCameraPosition* FindCameraPosition (const char* name, 00957 iRegion* region = 0) = 0; 00958 00960 virtual iCameraPositionList* GetCameraPositions () = 0; 00961 00986 virtual csPtr<iMeshWrapper> CreatePortal ( 00987 const char* name, 00988 iMeshWrapper* parentMesh, iSector* destSector, 00989 csVector3* vertices, int num_vertices, 00990 iPortal*& portal) = 0; 00991 01011 virtual csPtr<iMeshWrapper> CreatePortal ( 01012 const char* name, 01013 iSector* sourceSector, const csVector3& pos, 01014 iSector* destSector, 01015 csVector3* vertices, int num_vertices, 01016 iPortal*& portal) = 0; 01017 01031 virtual csPtr<iMeshWrapper> CreatePortalContainer (const char* name, 01032 iSector* sector = 0, const csVector3& pos = csVector3 (0, 0, 0)) = 0; 01033 01051 virtual void SetClearZBuf (bool yesno) = 0; 01052 01056 virtual bool GetClearZBuf () const = 0; 01057 01059 virtual bool GetDefaultClearZBuf () const = 0; 01060 01073 virtual void SetClearScreen (bool yesno) = 0; 01074 01078 virtual bool GetClearScreen () const = 0; 01079 01081 virtual bool GetDefaultClearScreen () const = 0; 01082 01089 virtual int GetBeginDrawFlags () const = 0; 01090 01094 virtual iRenderView* GetTopLevelClipper () const = 0; 01095 01104 virtual void PrecacheDraw (iRegion* region = 0) = 0; 01105 01117 virtual void Draw (iCamera* c, iClipper2D* clipper, 01118 iMeshWrapper* mesh = 0) = 0; 01119 01125 virtual void SetContext (iTextureHandle* ctxt) = 0; 01127 virtual iTextureHandle *GetContext () const = 0; 01128 01132 virtual iRenderLoopManager* GetRenderLoopManager () = 0; 01133 01146 virtual iRenderLoop* GetCurrentDefaultRenderloop () = 0; 01147 01154 virtual bool SetCurrentDefaultRenderloop (iRenderLoop* loop) = 0; 01155 01159 virtual uint GetCurrentFrameNumber () const = 0; 01160 01175 virtual void SetSaveableFlag (bool enable) = 0; 01176 01180 virtual bool GetSaveableFlag () = 0; 01181 01190 virtual csPtr<iLoaderContext> CreateLoaderContext ( 01191 iRegion* region = 0, bool curRegOnly = true) = 0; 01192 01210 virtual csPtr<iObjectIterator> GetNearbyObjects (iSector* sector, 01211 const csVector3& pos, float radius, bool crossPortals = true ) = 0; 01212 01213 01214 01224 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 01225 const csVector3& pos) = 0; 01226 01233 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 01234 const csVector3& pos) = 0; 01235 01245 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 01246 const csFrustum& frustum) = 0; 01247 01254 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 01255 const csFrustum& frustum) = 0; 01256 01263 virtual csPtr<iFrustumView> CreateFrustumView () = 0; 01264 01269 virtual csPtr<iObjectWatcher> CreateObjectWatcher () = 0; 01270 01272 virtual iSharedVariableList* GetVariableList () const = 0; 01273 01289 virtual bool RemoveObject (iBase* object) = 0; 01290 01299 virtual void DelayedRemoveObject (csTicks delay, iBase* object) = 0; 01300 01306 virtual void RemoveDelayedRemoves (bool remove = false) = 0; 01307 01309 virtual void DeleteAll () = 0; 01310 01318 virtual void ResetWorldSpecificSettings() = 0; 01319 01321 }; 01322 01325 #endif // __CS_IENGINE_ENGINE_H__
Generated for Crystal Space 1.2.1 by doxygen 1.5.3