Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
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 iCollection; 00047 struct iCollectionList; 00048 struct iDataBuffer; 00049 struct iFrustumView; 00050 struct iLight; 00051 struct iLightIterator; 00052 struct iLoaderContext; 00053 struct iMaterial; 00054 struct iMaterialList; 00055 struct iMaterialWrapper; 00056 struct iMeshFactoryList; 00057 struct iMeshFactoryWrapper; 00058 struct iMeshList; 00059 struct iMeshObject; 00060 struct iMeshObjectFactory; 00061 struct iMeshObjectType; 00062 struct iMeshWrapper; 00063 struct iMeshWrapperIterator; 00064 struct iObject; 00065 struct iObjectIterator; 00066 struct iObjectWatcher; 00067 struct iPortal; 00068 struct iProgressMeter; 00069 struct iRegion; 00070 struct iRegionList; 00071 struct iRenderLoop; 00072 struct iRenderLoopManager; 00073 struct iRenderView; 00074 struct iSector; 00075 struct iSectorIterator; 00076 struct iSectorList; 00077 struct iSharedVariableList; 00078 struct iTextureHandle; 00079 struct iTextureList; 00080 struct iTextureWrapper; 00081 00082 struct iEngine; 00083 00089 #define CS_ENGINE_CACHE_READ 1 00090 00094 #define CS_ENGINE_CACHE_WRITE 2 00095 00099 #define CS_ENGINE_CACHE_NOUPDATE 4 00100 00104 enum csRenderPrioritySorting 00105 { 00109 CS_RENDPRI_SORT_NONE = 0, 00110 00114 CS_RENDPRI_SORT_BACK2FRONT = 1, 00115 00119 CS_RENDPRI_SORT_FRONT2BACK = 2 00120 }; 00128 struct iEngineSectorCallback : public virtual iBase 00129 { 00130 SCF_INTERFACE(iEngineSectorCallback,2,0,0); 00134 virtual void NewSector (iEngine* engine, iSector* sector) = 0; 00135 00139 virtual void RemoveSector (iEngine* engine, iSector* sector) = 0; 00140 }; 00141 00142 00157 struct iEngine : public virtual iBase 00158 { 00159 SCF_INTERFACE(iEngine,2,0,0); 00160 00162 virtual iObject *QueryObject() = 0; 00163 00182 virtual bool Prepare (iProgressMeter* meter = 0) = 0; 00183 00191 virtual void PrepareTextures () = 0; 00192 00198 virtual void PrepareMeshes () = 0; 00199 00215 virtual void ForceRelight (iRegion* region = 0, 00216 iProgressMeter* meter = 0) = 0; 00217 00230 virtual void ForceRelight (iLight* light, iRegion* region = 0) = 0; 00231 00242 virtual void ShineLights (iRegion* region = 0, 00243 iProgressMeter* meter = 0) = 0; 00244 00257 virtual void SetLightingCacheMode (int mode) = 0; 00258 00260 virtual int GetLightingCacheMode () = 0; 00261 00274 virtual void SetCacheManager (iCacheManager* cache_mgr) = 0; 00275 00282 virtual void SetVFSCacheManager (const char* vfspath = 0) = 0; 00283 00287 virtual iCacheManager* GetCacheManager () = 0; 00288 00295 virtual void SetMaxLightmapSize (int w, int h) = 0; 00296 00301 virtual void GetMaxLightmapSize (int& w, int& h) = 0; 00302 00307 virtual void GetDefaultMaxLightmapSize (int& w, int& h) = 0; 00308 00310 virtual int GetMaxLightmapAspectRatio () const = 0; 00311 00338 virtual void RegisterRenderPriority (const char* name, long priority, 00339 csRenderPrioritySorting rendsort = CS_RENDPRI_SORT_NONE) = 0; 00340 00348 virtual long GetRenderPriority (const char* name) const = 0; 00350 virtual csRenderPrioritySorting GetRenderPrioritySorting (const char* name) const = 0; 00352 virtual csRenderPrioritySorting GetRenderPrioritySorting (long priority) const = 0; 00354 virtual long GetSkyRenderPriority () = 0; 00356 virtual long GetPortalRenderPriority () = 0; 00358 virtual long GetWallRenderPriority () = 0; 00360 virtual long GetObjectRenderPriority () = 0; 00362 virtual long GetAlphaRenderPriority () = 0; 00364 virtual void ClearRenderPriorities () = 0; 00366 virtual int GetRenderPriorityCount () const = 0; 00368 virtual const char* GetRenderPriorityName (long priority) const = 0; 00369 00384 virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt) = 0; 00385 00391 virtual iMaterialWrapper* CreateMaterial (const char *name, 00392 iTextureWrapper* texture) = 0; 00393 00395 virtual iMaterialList* GetMaterialList () const = 0; 00396 00409 virtual iMaterialWrapper* FindMaterial (const char* name, 00410 iRegion* region = 0) = 0; 00411 00435 virtual iTextureWrapper* CreateTexture (const char *name, 00436 const char *fileName, csColor *transp, int flags) = 0; 00437 00448 virtual iTextureWrapper* CreateBlackTexture (const char *name, 00449 int w, int h, csColor *transp, int flags) = 0; 00450 00455 virtual int GetTextureFormat () const = 0; 00456 00458 virtual iTextureList* GetTextureList () const = 0; 00459 00472 virtual iTextureWrapper* FindTexture (const char* name, 00473 iRegion* region = 0) = 0; 00474 00501 virtual csPtr<iLight> CreateLight (const char* name, const csVector3& pos, 00502 float radius, const csColor& color, 00503 csLightDynamicType dyntype = CS_LIGHT_DYNAMICTYPE_STATIC) = 0; 00504 00509 virtual iLight* FindLight (const char *Name, bool RegionOnly = false) 00510 const = 0; 00511 00516 virtual iLight* FindLightID (const char* light_id) const = 0; 00517 00524 virtual csPtr<iLightIterator> GetLightIterator (iRegion* region = 0) = 0; 00525 00536 virtual void RemoveLight (iLight* light) = 0; 00537 00542 virtual void SetAmbientLight (const csColor &) = 0; 00544 virtual void GetAmbientLight (csColor &) const = 0; 00546 virtual void GetDefaultAmbientLight (csColor &c) const = 0; 00547 00559 virtual int GetNearbyLights (iSector* sector, const csVector3& pos, 00560 iLight** lights, int max_num_lights) = 0; 00561 00573 virtual int GetNearbyLights (iSector* sector, const csBox3& box, 00574 iLight** lights, int max_num_lights) = 0; 00575 00585 virtual iSector *CreateSector (const char *name) = 0; 00586 00588 virtual iSectorList* GetSectors () = 0; 00589 00602 virtual iSector* FindSector (const char* name, 00603 iRegion* region = 0) = 0; 00604 00610 virtual csPtr<iSectorIterator> GetNearbySectors (iSector* sector, 00611 const csVector3& pos, float radius) = 0; 00612 00617 virtual void AddEngineSectorCallback (iEngineSectorCallback* cb) = 0; 00618 00622 virtual void RemoveEngineSectorCallback (iEngineSectorCallback* cb) = 0; 00623 00642 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshFactoryWrapper* factory, 00643 const char* name, iSector* sector = 0, 00644 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00645 00658 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshObject* meshobj, 00659 const char* name, iSector* sector = 0, 00660 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00661 00681 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* classid, 00682 const char* name, iSector* sector = 0, 00683 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00684 00689 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* name) = 0; 00690 00701 virtual csPtr<iMeshWrapper> CreateSectorWallsMesh (iSector* sector, 00702 const char* name) = 0; 00703 00713 virtual csPtr<iMeshWrapper> CreateThingMesh (iSector* sector, 00714 const char* name) = 0; 00715 00730 virtual csPtr<iMeshWrapper> LoadMeshWrapper ( 00731 const char* name, const char* loaderClassId, 00732 iDataBuffer* input, iSector* sector, const csVector3& pos) = 0; 00733 00738 virtual void AddMeshAndChildren (iMeshWrapper* mesh) = 0; 00739 00746 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 00747 const csVector3& pos, float radius, bool crossPortals = true ) = 0; 00748 00756 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 00757 const csBox3& box, bool crossPortals = true ) = 0; 00758 00760 virtual iMeshList* GetMeshes () = 0; 00761 00774 virtual iMeshWrapper* FindMeshObject (const char* name, 00775 iRegion* region = 0) = 0; 00776 00783 virtual void WantToDie (iMeshWrapper* mesh) = 0; 00784 00803 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* classId, 00804 const char* name) = 0; 00805 00813 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory ( 00814 iMeshObjectFactory * factory, const char* name) = 0; 00815 00821 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* name) = 0; 00822 00830 virtual csPtr<iMeshFactoryWrapper> LoadMeshFactory ( 00831 const char* name, const char* loaderClassId, 00832 iDataBuffer* input) = 0; 00833 00846 virtual iMeshFactoryWrapper* FindMeshFactory (const char* name, 00847 iRegion* region = 0) = 0; 00848 00850 virtual iMeshFactoryList* GetMeshFactories () = 0; 00851 00863 virtual iRegion* CreateRegion (const char* name) = 0; 00865 virtual iRegionList* GetRegions () = 0; 00866 00876 virtual csPtr<iCamera> CreateCamera () = 0; 00877 00890 virtual iCameraPosition* FindCameraPosition (const char* name, 00891 iRegion* region = 0) = 0; 00892 00894 virtual iCameraPositionList* GetCameraPositions () = 0; 00895 00920 virtual csPtr<iMeshWrapper> CreatePortal ( 00921 const char* name, 00922 iMeshWrapper* parentMesh, iSector* destSector, 00923 csVector3* vertices, int num_vertices, 00924 iPortal*& portal) = 0; 00925 00945 virtual csPtr<iMeshWrapper> CreatePortal ( 00946 const char* name, 00947 iSector* sourceSector, const csVector3& pos, 00948 iSector* destSector, 00949 csVector3* vertices, int num_vertices, 00950 iPortal*& portal) = 0; 00951 00965 virtual csPtr<iMeshWrapper> CreatePortalContainer (const char* name, 00966 iSector* sector = 0, const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00967 00985 virtual void SetClearZBuf (bool yesno) = 0; 00986 00990 virtual bool GetClearZBuf () const = 0; 00991 00993 virtual bool GetDefaultClearZBuf () const = 0; 00994 01007 virtual void SetClearScreen (bool yesno) = 0; 01008 01012 virtual bool GetClearScreen () const = 0; 01013 01015 virtual bool GetDefaultClearScreen () const = 0; 01016 01023 virtual int GetBeginDrawFlags () const = 0; 01024 01028 virtual iRenderView* GetTopLevelClipper () const = 0; 01029 01038 virtual void PrecacheDraw (iRegion* region = 0) = 0; 01039 01047 virtual void Draw (iCamera* c, iClipper2D* clipper) = 0; 01048 01054 virtual void SetContext (iTextureHandle* ctxt) = 0; 01056 virtual iTextureHandle *GetContext () const = 0; 01057 01061 virtual iRenderLoopManager* GetRenderLoopManager () = 0; 01062 01075 virtual iRenderLoop* GetCurrentDefaultRenderloop () = 0; 01076 01083 virtual bool SetCurrentDefaultRenderloop (iRenderLoop* loop) = 0; 01084 01088 virtual uint GetCurrentFrameNumber () const = 0; 01089 01104 virtual void SetSaveableFlag (bool enable) = 0; 01105 01109 virtual bool GetSaveableFlag () = 0; 01110 01119 virtual csPtr<iLoaderContext> CreateLoaderContext ( 01120 iRegion* region = 0, bool curRegOnly = true) = 0; 01121 01139 virtual csPtr<iObjectIterator> GetNearbyObjects (iSector* sector, 01140 const csVector3& pos, float radius, bool crossPortals = true ) = 0; 01141 01142 01143 01153 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 01154 const csVector3& pos) = 0; 01155 01162 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 01163 const csVector3& pos) = 0; 01164 01174 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 01175 const csFrustum& frustum) = 0; 01176 01183 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 01184 const csFrustum& frustum) = 0; 01185 01192 virtual csPtr<iFrustumView> CreateFrustumView () = 0; 01193 01198 virtual csPtr<iObjectWatcher> CreateObjectWatcher () = 0; 01199 01201 virtual iSharedVariableList* GetVariableList () const = 0; 01202 01204 virtual iCollectionList* GetCollections () = 0; 01205 01218 virtual iCollection* FindCollection (const char* name, 01219 iRegion* region = 0) = 0; 01220 01236 virtual bool RemoveObject (iBase* object) = 0; 01237 01239 virtual void DeleteAll () = 0; 01240 01248 virtual void ResetWorldSpecificSettings() = 0; 01249 01251 }; 01252 01255 #endif // __CS_IENGINE_ENGINE_H__
Generated for Crystal Space by doxygen 1.4.4