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 00129 struct iEngine : public iBase 00130 { 00132 virtual iObject *QueryObject() = 0; 00133 00149 virtual bool Prepare (iProgressMeter* meter = 0) = 0; 00150 00166 virtual void ForceRelight (iRegion* region = 0, 00167 iProgressMeter* meter = 0) = 0; 00168 00181 virtual void ForceRelight (iLight* light, iRegion* region = 0) = 0; 00182 00193 virtual void RemoveLight (iLight* light) = 0; 00194 00202 virtual void PrepareTextures () = 0; 00203 00209 virtual void PrepareMeshes () = 0; 00210 00221 virtual void ShineLights (iRegion* region = 0, 00222 iProgressMeter* meter = 0) = 0; 00223 00228 virtual int GetTextureFormat () const = 0; 00229 00231 virtual void DeleteAll () = 0; 00232 00256 virtual void RegisterRenderPriority (const char* name, long priority, 00257 int rendsort = CS_RENDPRI_NONE, bool do_camera = false) = 0; 00258 00266 virtual long GetRenderPriority (const char* name) const = 0; 00268 virtual void SetRenderPriorityCamera (long priority, bool do_camera) = 0; 00270 virtual bool GetRenderPriorityCamera (const char* name) const = 0; 00272 virtual bool GetRenderPriorityCamera (long priority) const = 0; 00274 virtual int GetRenderPrioritySorting (const char* name) const = 0; 00276 virtual int GetRenderPrioritySorting (long priority) const = 0; 00278 virtual long GetSkyRenderPriority () = 0; 00280 virtual long GetPortalRenderPriority () = 0; 00282 virtual long GetWallRenderPriority () = 0; 00284 virtual long GetObjectRenderPriority () = 0; 00286 virtual long GetAlphaRenderPriority () = 0; 00288 virtual void ClearRenderPriorities () = 0; 00290 virtual int GetRenderPriorityCount () const = 0; 00292 virtual const char* GetRenderPriorityName (long priority) const = 0; 00293 00303 virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt) = 0; 00304 00320 virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt, 00321 int num_layers, iTextureWrapper** wrappers, csTextureLayer* layers) = 0; 00322 00341 virtual iTextureWrapper* CreateTexture (const char *name, 00342 const char *fileName, csColor *transp, int flags) = 0; 00343 00354 virtual iTextureWrapper* CreateBlackTexture (const char *name, 00355 int w, int h, csColor *iTransp, int iFlags) = 0; 00356 00362 virtual iMaterialWrapper* CreateMaterial (const char *name, 00363 iTextureWrapper* texture) = 0; 00368 virtual iSector *CreateSector (const char *name) = 0; 00369 00380 virtual csPtr<iMeshWrapper> CreateSectorWallsMesh (iSector* sector, 00381 const char* name) = 0; 00382 00392 virtual csPtr<iMeshWrapper> CreateThingMesh (iSector* sector, 00393 const char* name) = 0; 00394 00396 virtual iSectorList* GetSectors () = 0; 00398 virtual iMeshFactoryList* GetMeshFactories () = 0; 00400 virtual iMeshList* GetMeshes () = 0; 00402 virtual iCollectionList* GetCollections () = 0; 00404 virtual iCameraPositionList* GetCameraPositions () = 0; 00406 virtual iTextureList* GetTextureList () const = 0; 00408 virtual iMaterialList* GetMaterialList () const = 0; 00410 virtual iSharedVariableList* GetVariableList () const = 0; 00411 00418 virtual iRegion* CreateRegion (const char* name) = 0; 00420 virtual iRegionList* GetRegions () = 0; 00421 00434 virtual iMaterialWrapper* FindMaterial (const char* name, 00435 iRegion* region = 0) = 0; 00448 virtual iTextureWrapper* FindTexture (const char* name, 00449 iRegion* region = 0) = 0; 00450 00463 virtual iSector* FindSector (const char* name, 00464 iRegion* region = 0) = 0; 00465 00478 virtual iMeshWrapper* FindMeshObject (const char* name, 00479 iRegion* region = 0) = 0; 00492 virtual iMeshFactoryWrapper* FindMeshFactory (const char* name, 00493 iRegion* region = 0) = 0; 00506 virtual iCameraPosition* FindCameraPosition (const char* name, 00507 iRegion* region = 0) = 0; 00520 virtual iCollection* FindCollection (const char* name, 00521 iRegion* region = 0) = 0; 00522 00536 virtual void SetLightingCacheMode (int mode) = 0; 00537 00539 virtual int GetLightingCacheMode () = 0; 00540 00553 virtual void SetClearZBuf (bool yesno) = 0; 00554 00558 virtual bool GetClearZBuf () const = 0; 00559 00561 virtual bool GetDefaultClearZBuf () const = 0; 00562 00575 virtual void SetClearScreen (bool yesno) = 0; 00576 00580 virtual bool GetClearScreen () const = 0; 00581 00583 virtual bool GetDefaultClearScreen () const = 0; 00584 00591 virtual void SetMaxLightmapSize(int w, int h) = 0; 00592 00597 virtual void GetMaxLightmapSize(int& w, int& h) = 0; 00598 00603 virtual void GetDefaultMaxLightmapSize(int& w, int& h) = 0; 00604 00606 virtual int GetMaxLightmapAspectRatio () const = 0; 00607 00615 virtual void ResetWorldSpecificSettings() = 0; 00616 00621 virtual csPtr<iCamera> CreateCamera () = 0; 00622 00644 virtual csPtr<iLight> CreateLight (const char* name, const csVector3& pos, 00645 float radius, const csColor& color, 00646 int dyntype = CS_LIGHT_DYNAMICTYPE_STATIC) = 0; 00647 00652 virtual iLight* FindLight (const char *Name, bool RegionOnly = false) 00653 const = 0; 00654 00659 virtual iLight* FindLightID (const char* light_id) const = 0; 00660 00667 virtual csPtr<iLightIterator> GetLightIterator (iRegion* region = 0) = 0; 00668 00675 virtual int GetBeginDrawFlags () const = 0; 00676 00680 virtual iClipper2D* GetTopLevelClipper () const = 0; 00681 00695 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* classId, 00696 const char* name) = 0; 00697 00705 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory ( 00706 iMeshObjectFactory * factory, const char* name) = 0; 00707 00713 virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* name) = 0; 00714 00723 virtual csPtr<iLoaderContext> CreateLoaderContext ( 00724 iRegion* region = 0, bool curRegOnly = true) = 0; 00725 00733 virtual csPtr<iMeshFactoryWrapper> LoadMeshFactory ( 00734 const char* name, const char* loaderClassId, 00735 iDataBuffer* input) = 0; 00736 00750 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshFactoryWrapper* factory, 00751 const char* name, iSector* sector = 0, 00752 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00753 00766 virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshObject* meshobj, 00767 const char* name, iSector* sector = 0, 00768 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00769 00789 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* classid, 00790 const char* name, iSector* sector = 0, 00791 const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00792 00797 virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* name) = 0; 00798 00813 virtual csPtr<iMeshWrapper> LoadMeshWrapper ( 00814 const char* name, const char* loaderClassId, 00815 iDataBuffer* input, iSector* sector, const csVector3& pos) = 0; 00816 00830 virtual csPtr<iMeshWrapper> CreatePortalContainer (const char* name, 00831 iSector* sector = 0, const csVector3& pos = csVector3 (0, 0, 0)) = 0; 00832 00850 virtual csPtr<iMeshWrapper> CreatePortal ( 00851 const char* name, 00852 iMeshWrapper* parentMesh, iSector* destSector, 00853 csVector3* vertices, int num_vertices, 00854 iPortal*& portal) = 0; 00855 00873 virtual csPtr<iMeshWrapper> CreatePortal ( 00874 const char* name, 00875 iSector* sourceSector, const csVector3& pos, 00876 iSector* destSector, 00877 csVector3* vertices, int num_vertices, 00878 iPortal*& portal) = 0; 00879 00887 virtual void Draw (iCamera* c, iClipper2D* clipper) = 0; 00888 00894 virtual void SetContext (iTextureHandle* ctxt) = 0; 00896 virtual iTextureHandle *GetContext () const = 0; 00897 00902 virtual void SetAmbientLight (const csColor &) = 0; 00904 virtual void GetAmbientLight (csColor &) const = 0; 00905 00917 virtual int GetNearbyLights (iSector* sector, const csVector3& pos, 00918 iLight** lights, int max_num_lights) = 0; 00919 00931 virtual int GetNearbyLights (iSector* sector, const csBox3& box, 00932 iLight** lights, int max_num_lights) = 0; 00933 00939 virtual csPtr<iSectorIterator> GetNearbySectors (iSector* sector, 00940 const csVector3& pos, float radius) = 0; 00941 00954 virtual csPtr<iObjectIterator> GetNearbyObjects (iSector* sector, 00955 const csVector3& pos, float radius, bool crossPortals = true ) = 0; 00956 00963 virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector, 00964 const csVector3& pos, float radius, bool crossPortals = true ) = 0; 00965 00975 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 00976 const csVector3& pos) = 0; 00977 00984 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 00985 const csVector3& pos) = 0; 00986 00996 virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector, 00997 const csFrustum& frustum) = 0; 00998 01005 virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector, 01006 const csFrustum& frustum) = 0; 01007 01023 virtual bool RemoveObject (iBase* object) = 0; 01024 01032 virtual void SetCacheManager (iCacheManager* cache_mgr) = 0; 01033 01037 virtual iCacheManager* GetCacheManager () = 0; 01038 01040 virtual void GetDefaultAmbientLight (csColor &c) const = 0; 01041 01048 virtual csPtr<iFrustumView> CreateFrustumView () = 0; 01049 01054 virtual csPtr<iObjectWatcher> CreateObjectWatcher () = 0; 01055 01062 virtual void WantToDie (iMeshWrapper* mesh) = 0; 01063 01064 // ====================================================================== 01065 // Render loop stuff 01066 // ====================================================================== 01067 01072 virtual iRenderLoopManager* GetRenderLoopManager () = 0; 01073 01087 virtual iRenderLoop* GetCurrentDefaultRenderloop () = 0; 01088 01095 virtual bool SetCurrentDefaultRenderloop (iRenderLoop* loop) = 0; 01096 01100 virtual uint32 GetCurrentFrameNumber () = 0; 01101 }; 01102 01105 #endif // __CS_IENGINE_ENGINE_H__
Generated for Crystal Space by doxygen 1.2.18