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.h" 00032 #include "csgeom/vector3.h" 00033 #include "iengine/light.h" 00034 00035 class csEngine; 00036 class csVector3; 00037 class csFrustum; 00038 class csMatrix3; 00039 class csColor; 00040 class csBox3; 00041 struct csTextureLayer; 00042 00043 struct iSector; 00044 struct iFrustumView; 00045 struct iSectorIterator; 00046 struct iObjectIterator; 00047 struct iLight; 00048 struct iLightIterator; 00049 struct iSprite; 00050 struct iMeshWrapperIterator; 00051 struct iMeshObject; 00052 struct iMeshObjectFactory; 00053 struct iMeshWrapper; 00054 struct iMeshFactoryWrapper; 00055 struct iMeshObjectType; 00056 struct iMaterial; 00057 struct iMaterialWrapper; 00058 struct iMaterialList; 00059 struct iTextureWrapper; 00060 struct iTextureHandle; 00061 struct iTextureList; 00062 struct iCameraPosition; 00063 struct iCameraPositionList; 00064 struct iRegion; 00065 struct iPortal; 00066 struct iGraphics3D; 00067 struct iClipper2D; 00068 struct iObject; 00069 struct iObjectWatcher; 00070 struct iCollection; 00071 struct iCollectionList; 00072 struct iDataBuffer; 00073 struct iCamera; 00074 struct iRenderView; 00075 struct iSectorList; 00076 struct iMeshList; 00077 struct iMeshFactoryList; 00078 struct iProgressMeter; 00079 struct iRegionList; 00080 struct iLoaderContext; 00081 struct iCacheManager; 00082 struct iSharedVariableList; 00083 struct iRenderLoopManager; 00084 struct iRenderLoop; 00085 00091 #define CS_ENGINE_CACHE_READ 1 00092 00096 #define CS_ENGINE_CACHE_WRITE 2 00097 00101 #define CS_ENGINE_CACHE_NOUPDATE 4 00102 00109 #define CS_RENDPRI_NONE 0 00110 00114 #define CS_RENDPRI_BACK2FRONT 1 00115 00119 #define CS_RENDPRI_FRONT2BACK 2 00120 00122 SCF_VERSION (iEngine, 0, 22, 0); 00123 00142 struct iEngine : public iBase 00143 { 00145 virtual iObject *QueryObject() = 0; 00146 00162 virtual bool Prepare (iProgressMeter* meter = 0) = 0; 00163 00179 virtual void ForceRelight (iRegion* region = 0, 00180 iProgressMeter* meter = 0) = 0; 00181 00194 virtual void ForceRelight (iLight* light, iRegion* region = 0) = 0; 00195 00206 virtual void RemoveLight (iLight* light) = 0; 00207 00215 virtual void PrepareTextures () = 0; 00216 00222 virtual void PrepareMeshes () = 0; 00223 00234 virtual void ShineLights (iRegion* region = 0, 00235 iProgressMeter* meter = 0) = 0; 00236 00241 virtual int GetTextureFormat () const = 0; 00242 00244 virtual void DeleteAll () = 0; 00245 00267 virtual void RegisterRenderPriority (const char* name, long priority, 00268 int rendsort = CS_RENDPRI_NONE) = 0; 00269 00277 virtual long GetRenderPriority (const char* name) const = 0; 00279 virtual int GetRenderPrioritySorting (const char* name) const = 0; 00281 virtual int GetRenderPrioritySorting (long priority) const = 0; 00283 virtual long GetSkyRenderPriority () = 0; 00285 virtual long GetPortalRenderPriority () = 0; 00287 virtual long GetWallRenderPriority () = 0; 00289 virtual long GetObjectRenderPriority () = 0; 00291 virtual long GetAlphaRenderPriority () = 0; 00293 virtual void ClearRenderPriorities () = 0; 00295 virtual int GetRenderPriorityCount () const = 0; 00297 virtual const char* GetRenderPriorityName (long priority) const = 0; 00298 00308 virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt) = 0; 00309 00325 virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt, 00326 int num_layers, iTextureWrapper** wrappers, csTextureLayer* layers) = 0; 00327 00346 virtual iTextureWrapper* CreateTexture (const char *name, 00347 const char *fileName, csColor *transp, int flags) = 0; 00348 00359 virtual iTextureWrapper* CreateBlackTexture (const char *name, 00360 int w, int h, csColor *iTransp, int iFlags) = 0; 00361 00367 virtual iMaterialWrapper* CreateMaterial (const char *name, 00368 iTextureWrapper* texture) = 0; 00373 virtual iSector *CreateSector (const char *name) = 0; 00374 00385 virtual csPtr<iMeshWrapper> CreateSectorWallsMesh (iSector* sector, 00386 const char* name) = 0; 00387 00397 virtual csPtr<iMeshWrapper> CreateThingMesh (iSector* sector, 00398 const char* name) = 0; 00399 00401 virtual iSectorList* GetSectors () = 0; 00403 virtual iMeshFactoryList* GetMeshFactories () = 0; 00405 virtual iMeshList* GetMeshes () = 0; 00407 virtual iCollectionList* GetCollections () = 0; 00409 virtual iCameraPositionList* GetCameraPositions () = 0; 00411 virtual iTextureList* GetTextureList () const = 0; 00413 virtual iMaterialList* GetMaterialList () const = 0; 00415 virtual iSharedVariableList* GetVariableList () const = 0; 00416 00423 virtual iRegion* CreateRegion (const char* name) = 0; 00425 virtual iRegionList* GetRegions () = 0; 00426 00439 virtual iMaterialWrapper* FindMaterial (const char* name, 00440 iRegion* region = 0) = 0; 00453 virtual iTextureWrapper* FindTexture (const char* name, 00454 iRegion* region = 0) = 0; 00455 00468 virtual iSector* FindSector (const char* name, 00469 iRegion* region = 0) = 0; 00470 00483 virtual iMeshWrapper* FindMeshObject (const char* name, 00484 iRegion* region = 0) = 0; 00497 virtual iMeshFactoryWrapper* FindMeshFactory (const char* name, 00498 iRegion* region = 0) = 0; 00511 virtual iCameraPosition* FindCameraPosition (const char* name, 00512 iRegion* region = 0) = 0; 00525 virtual iCollection* FindCollection (const char* name, 00526 iRegion* region = 0) = 0; 00527 00541 virtual void SetLightingCacheMode (int mode) = 0; 00542 00544 virtual int GetLightingCacheMode () = 0; 00545 00558 virtual void SetClearZBuf (bool yesno) = 0; 00559 00563 virtual bool GetClearZBuf () const = 0; 00564 00566 virtual bool GetDefaultClearZBuf () const = 0; 00567 00580 virtual void SetClearScreen (bool yesno) = 0; 00581 00585 virtual bool GetClearScreen () const = 0; 00586 00588 virtual bool GetDefaultClearScreen () const = 0; 00589 00596 virtual void SetMaxLightmapSize(int w, int h) = 0; 00597 00602 virtual void GetMaxLightmapSize(int& w, int& h) = 0; 00603 00608 virtual void GetDefaultMaxLightmapSize(int& w, int& h) = 0; 00609 00611 virtual int GetMaxLightmapAspectRatio () const = 0; 00612 00620 virtual void ResetWorldSpecificSettings() = 0; 00621 00626 virtual csPtr<iCamera> CreateCamera () = 0; 00627 00649 virtual csPtr<iLight> CreateLight (const char* name, const csVector3& pos, 00650 float radius, const csColor& color, 00651 int dyntype = CS_LIGHT_DYNAMICTYPE_STATIC) = 0; 00652 00657 virtual iLight* FindLight (const char *Name, bool RegionOnly = false) 00658 const = 0; 00659 00664 virtual iLight* FindLightID (const char* light_id) const = 0; 00665 00672 virtual csPtr<iLightIterator> GetLightIterator (iRegion* region = 0) = 0; 00673 00680 virtual int GetBeginDrawFlags () const = 0; 00681 00685 virtual iRenderView* GetTopLevelClipper () const = 0; 00686 00700 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* classId, 00701 const char* name) = 0; 00702 00710 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory ( 00711 iMeshObjectFactory * factory, const char* name) = 0; 00712 00718 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* name) = 0; 00719 00728 virtual csPtr<iLoaderContext> CreateLoaderContext ( 00729 iRegion* region = 0, bool curRegOnly = true) = 0; 00730 00738 virtual csPtr<iMeshFactoryWrapper> LoadMeshFactory ( 00739 const char* name, const char* loaderClassId, 00740 iDataBuffer* input) = 0; 00741 00755 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshFactoryWrapper* factory, 00756 const char* name, iSector* sector = 0, 00757 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00758 00771 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshObject* meshobj, 00772 const char* name, iSector* sector = 0, 00773 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00774 00794 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* classid, 00795 const char* name, iSector* sector = 0, 00796 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00797 00802 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* name) = 0; 00803 00818 virtual csPtr<iMeshWrapper> LoadMeshWrapper ( 00819 const char* name, const char* loaderClassId, 00820 iDataBuffer* input, iSector* sector, const csVector3& pos) = 0; 00821 00835 virtual csPtr<iMeshWrapper> CreatePortalContainer (const char* name, 00836 iSector* sector = 0, const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00837 00855 virtual csPtr<iMeshWrapper> CreatePortal ( 00856 const char* name, 00857 iMeshWrapper* parentMesh, iSector* destSector, 00858 csVector3* vertices, int num_vertices, 00859 iPortal*& portal) = 0; 00860 00878 virtual csPtr<iMeshWrapper> CreatePortal ( 00879 const char* name, 00880 iSector* sourceSector, const csVector3& pos, 00881 iSector* destSector, 00882 csVector3* vertices, int num_vertices, 00883 iPortal*& portal) = 0; 00884 00892 virtual void Draw (iCamera* c, iClipper2D* clipper) = 0; 00893 00899 virtual void SetContext (iTextureHandle* ctxt) = 0; 00901 virtual iTextureHandle *GetContext () const = 0; 00902 00907 virtual void SetAmbientLight (const csColor &) = 0; 00909 virtual void GetAmbientLight (csColor &) const = 0; 00910 00922 virtual int GetNearbyLights (iSector* sector, const csVector3& pos, 00923 iLight** lights, int max_num_lights) = 0; 00924 00936 virtual int GetNearbyLights (iSector* sector, const csBox3& box, 00937 iLight** lights, int max_num_lights) = 0; 00938 00944 virtual csPtr<iSectorIterator> GetNearbySectors (iSector* sector, 00945 const csVector3& pos, float radius) = 0; 00946 00959 virtual csPtr<iObjectIterator> GetNearbyObjects (iSector* sector, 00960 const csVector3& pos, float radius, bool crossPortals = true ) = 0; 00961 00968 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 00969 const csVector3& pos, float radius, bool crossPortals = true ) = 0; 00970 00980 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 00981 const csVector3& pos) = 0; 00982 00989 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 00990 const csVector3& pos) = 0; 00991 01001 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 01002 const csFrustum& frustum) = 0; 01003 01010 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 01011 const csFrustum& frustum) = 0; 01012 01028 virtual bool RemoveObject (iBase* object) = 0; 01029 01037 virtual void SetCacheManager (iCacheManager* cache_mgr) = 0; 01038 01042 virtual iCacheManager* GetCacheManager () = 0; 01043 01045 virtual void GetDefaultAmbientLight (csColor &c) const = 0; 01046 01053 virtual csPtr<iFrustumView> CreateFrustumView () = 0; 01054 01059 virtual csPtr<iObjectWatcher> CreateObjectWatcher () = 0; 01060 01067 virtual void WantToDie (iMeshWrapper* mesh) = 0; 01068 01069 // ====================================================================== 01070 // Render loop stuff 01071 // ====================================================================== 01072 01077 virtual iRenderLoopManager* GetRenderLoopManager () = 0; 01078 01092 virtual iRenderLoop* GetCurrentDefaultRenderloop () = 0; 01093 01100 virtual bool SetCurrentDefaultRenderloop (iRenderLoop* loop) = 0; 01101 01105 virtual uint GetCurrentFrameNumber () const = 0; 01106 }; 01107 01110 #endif // __CS_IENGINE_ENGINE_H__
Generated for Crystal Space by doxygen 1.2.18