CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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.h"
00032 #include "csgeom/vector3.h"
00033 
00034 class csEngine;
00035 class csVector3;
00036 class csFrustum;
00037 class csMatrix3;
00038 class csColor;
00039 class csBox3;
00040 struct csTextureLayer;
00041 
00042 struct iSector;
00043 struct iFrustumView;
00044 struct iSectorIterator;
00045 struct iObjectIterator;
00046 struct iLight;
00047 struct iLightIterator;
00048 struct iStatLight;
00049 struct iDynLight;
00050 struct iSprite;
00051 struct iMeshWrapperIterator;
00052 struct iMeshObject;
00053 struct iMeshObjectFactory;
00054 struct iMeshWrapper;
00055 struct iMeshFactoryWrapper;
00056 struct iMeshObjectType;
00057 struct iMaterial;
00058 struct iMaterialWrapper;
00059 struct iMaterialList;
00060 struct iTextureWrapper;
00061 struct iTextureHandle;
00062 struct iTextureList;
00063 struct iCameraPosition;
00064 struct iCameraPositionList;
00065 struct iRegion;
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 
00092 #define CS_NLIGHT_SHADOWS 1
00093 
00097 #define CS_NLIGHT_STATIC 2
00098 
00102 #define CS_NLIGHT_DYNAMIC 4
00103 
00107 #define CS_NLIGHT_NEARBYSECTORS 8
00108 
00115 #define CS_ENGINE_CACHE_READ 1
00116 
00120 #define CS_ENGINE_CACHE_WRITE 2
00121 
00125 #define CS_ENGINE_CACHE_NOUPDATE 4
00126 
00133 #define CS_RENDPRI_NONE 0
00134 
00138 #define CS_RENDPRI_BACK2FRONT 1
00139 
00143 #define CS_RENDPRI_FRONT2BACK 2
00144 
00146 SCF_VERSION (iEngine, 0, 21, 0);
00147 
00153 struct iEngine : public iBase
00154 {
00156   virtual iObject *QueryObject() = 0;
00157 
00173   virtual bool Prepare (iProgressMeter* meter = 0) = 0;
00174 
00190   virtual void ForceRelight (iRegion* region = 0,
00191         iProgressMeter* meter = 0) = 0;
00192 
00205   virtual void ForceRelight (iStatLight* light, iRegion* region = 0) = 0;
00206 
00217   virtual void RemoveLight (iStatLight* light) = 0;
00218 
00226   virtual void PrepareTextures () = 0;
00227 
00233   virtual void PrepareMeshes () = 0;
00234 
00245   virtual void ShineLights (iRegion* region = 0,
00246         iProgressMeter* meter = 0) = 0;
00247 
00252   virtual int GetTextureFormat () const = 0;
00253 
00255   virtual void DeleteAll () = 0;
00256 
00280   virtual void RegisterRenderPriority (const char* name, long priority,
00281         int rendsort = CS_RENDPRI_NONE, bool do_camera = false) = 0;
00282 
00284   virtual long GetRenderPriority (const char* name) const = 0;
00286   virtual void SetRenderPriorityCamera (long priority, bool do_camera) = 0;
00288   virtual bool GetRenderPriorityCamera (const char* name) const = 0;
00290   virtual bool GetRenderPriorityCamera (long priority) const = 0;
00292   virtual int GetRenderPrioritySorting (const char* name) const = 0;
00294   virtual int GetRenderPrioritySorting (long priority) const = 0;
00296   virtual long GetSkyRenderPriority () const = 0;
00298   virtual long GetWallRenderPriority () const = 0;
00300   virtual long GetObjectRenderPriority () const = 0;
00302   virtual long GetAlphaRenderPriority () const = 0;
00304   virtual void ClearRenderPriorities () = 0;
00306   virtual int GetRenderPriorityCount () const = 0;
00308   virtual const char* GetRenderPriorityName (long priority) const = 0;
00309 
00318   virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt) = 0;
00319 
00334   virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt,
00335         int num_layers, iTextureWrapper** wrappers, csTextureLayer* layers) = 0;
00336 
00353   virtual iTextureWrapper* CreateTexture (const char *name,
00354         const char *fileName, csColor *transp, int flags) = 0;
00355 
00365   virtual iTextureWrapper* CreateBlackTexture (const char *name,
00366         int w, int h, csColor *iTransp, int iFlags) = 0;
00367 
00372   virtual iMaterialWrapper* CreateMaterial (const char *name,
00373         iTextureWrapper* texture) = 0;
00378   virtual iSector *CreateSector (const char *name) = 0;
00379 
00390   virtual csPtr<iMeshWrapper> CreateSectorWallsMesh (iSector* sector,
00391       const char* name) = 0;
00392 
00402   virtual csPtr<iMeshWrapper> CreateThingMesh (iSector* sector,
00403         const char* name) = 0;
00404 
00406   virtual iSectorList* GetSectors () = 0;
00408   virtual iMeshFactoryList* GetMeshFactories () = 0;
00410   virtual iMeshList* GetMeshes () = 0;
00412   virtual iCollectionList* GetCollections () = 0;
00414   virtual iCameraPositionList* GetCameraPositions () = 0;
00416   virtual iTextureList* GetTextureList () const = 0;
00418   virtual iMaterialList* GetMaterialList () const = 0;
00420   virtual iSharedVariableList* GetVariableList () const = 0;
00421 
00428   virtual iRegion* CreateRegion (const char* name) = 0;
00430   virtual iRegionList* GetRegions () = 0;
00431 
00444   virtual iMaterialWrapper* FindMaterial (const char* name,
00445         iRegion* region = 0) = 0;
00458   virtual iTextureWrapper* FindTexture (const char* name,
00459         iRegion* region = 0) = 0;
00460 
00473   virtual iSector* FindSector (const char* name,
00474         iRegion* region = 0) = 0;
00475 
00488   virtual iMeshWrapper* FindMeshObject (const char* name,
00489         iRegion* region = 0) = 0;
00502   virtual iMeshFactoryWrapper* FindMeshFactory (const char* name,
00503         iRegion* region = 0) = 0;
00516   virtual iCameraPosition* FindCameraPosition (const char* name,
00517         iRegion* region = 0) = 0;
00530   virtual iCollection* FindCollection (const char* name,
00531         iRegion* region = 0) = 0;
00532 
00546   virtual void SetLightingCacheMode (int mode) = 0;
00547 
00549   virtual int GetLightingCacheMode () = 0;
00550 
00558   virtual void SetFastMeshThresshold (int th) = 0;
00560   virtual int GetFastMeshThresshold () const = 0;
00561 
00574   virtual void SetClearZBuf (bool yesno) = 0;
00575 
00579   virtual bool GetClearZBuf () const = 0;
00580 
00582   virtual bool GetDefaultClearZBuf () const = 0;
00583 
00596   virtual void SetClearScreen (bool yesno) = 0;
00597 
00601   virtual bool GetClearScreen () const = 0;
00602 
00604   virtual bool GetDefaultClearScreen () const = 0;
00605 
00613   virtual void SetMaxLightmapSize(int w, int h) = 0;
00614 
00620   virtual void GetMaxLightmapSize(int& w, int& h) = 0;
00621 
00627   virtual void GetDefaultMaxLightmapSize(int& w, int& h) = 0;
00628 
00630   virtual bool GetLightmapsRequirePO2 () const = 0;
00631 
00633   virtual int GetMaxLightmapAspectRatio () const = 0;
00634   
00642   virtual void ResetWorldSpecificSettings() = 0;  
00643 
00648   virtual csPtr<iCamera> CreateCamera () = 0;
00649 
00661   virtual csPtr<iStatLight> CreateLight (const char* name, const csVector3& pos,
00662         float radius, const csColor& color, bool pseudoDyn) = 0;
00663 
00668   virtual iStatLight* FindLight (const char *Name, bool RegionOnly = false)
00669     const = 0;
00670 
00675   virtual iStatLight* FindLightID (const char* light_id) const = 0;
00676 
00682   virtual csPtr<iLightIterator> GetLightIterator (iRegion* region = 0) = 0;
00683 
00696   virtual csPtr<iDynLight> CreateDynLight (const csVector3& pos, float radius,
00697         const csColor& color) = 0;
00698 
00702   virtual void RemoveDynLight (iDynLight* light) = 0;
00703 
00705   virtual iDynLight* GetFirstDynLight () const = 0;
00706 
00713   virtual int GetBeginDrawFlags () const = 0;
00714 
00718   virtual iClipper2D* GetTopLevelClipper () const = 0;
00719 
00733   virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* classId,
00734         const char* name) = 0;
00735 
00743   virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (iMeshObjectFactory * factory,
00744         const char* name) = 0;
00745 
00751   virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* name) = 0;
00752 
00761   virtual csPtr<iLoaderContext> CreateLoaderContext (
00762         iRegion* region = 0, bool curRegOnly = true) = 0;
00763 
00771   virtual csPtr<iMeshFactoryWrapper> LoadMeshFactory (
00772         const char* name, const char* loaderClassId,
00773         iDataBuffer* input) = 0;
00774 
00788   virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshFactoryWrapper* factory,
00789         const char* name, iSector* sector = 0,
00790         const csVector3& pos = csVector3(0, 0, 0)) = 0;
00791 
00804   virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshObject* meshobj,
00805         const char* name, iSector* sector = 0,
00806         const csVector3& pos = csVector3(0, 0, 0)) = 0;
00807 
00827   virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* classid,
00828         const char* name, iSector* sector = 0,
00829         const csVector3& pos = csVector3(0, 0, 0)) = 0;
00830 
00835   virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* name) = 0;
00836 
00851   virtual csPtr<iMeshWrapper> LoadMeshWrapper (
00852         const char* name, const char* loaderClassId,
00853         iDataBuffer* input, iSector* sector, const csVector3& pos) = 0;
00854 
00862   virtual void Draw (iCamera* c, iClipper2D* clipper) = 0;
00863 
00869   virtual void SetContext (iTextureHandle* ctxt) = 0;
00871   virtual iTextureHandle *GetContext () const = 0;
00872 
00877   virtual void SetAmbientLight (const csColor &) = 0;
00879   virtual void GetAmbientLight (csColor &) const = 0;
00880 
00900   virtual int GetNearbyLights (iSector* sector, const csVector3& pos,
00901         uint32 flags, iLight** lights, int max_num_lights) = 0;
00902 
00922   virtual int GetNearbyLights (iSector* sector, const csBox3& box,
00923         uint32 flags, iLight** lights, int max_num_lights) = 0;
00924 
00930   virtual csPtr<iSectorIterator> GetNearbySectors (iSector* sector,
00931         const csVector3& pos, float radius) = 0;
00932 
00945   virtual csPtr<iObjectIterator> GetNearbyObjects (iSector* sector,
00946     const csVector3& pos, float radius, bool crossPortals = true ) = 0;
00947 
00954   virtual csPtr<iMeshWrapperIterator> GetNearbyMeshes (iSector* sector,
00955     const csVector3& pos, float radius, bool crossPortals = true ) = 0;
00956 
00966   virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector,
00967     const csVector3& pos) = 0;
00968 
00975   virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector,
00976     const csVector3& pos) = 0;
00977 
00987   virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector,
00988     const csFrustum& frustum) = 0;
00989 
00996   virtual csPtr<iMeshWrapperIterator> GetVisibleMeshes (iSector* sector,
00997     const csFrustum& frustum) = 0;
00998 
01014   virtual bool RemoveObject (iBase* object) = 0;
01015 
01023   virtual void SetCacheManager (iCacheManager* cache_mgr) = 0;
01024 
01028   virtual iCacheManager* GetCacheManager () = 0;
01029 
01031   virtual void GetDefaultAmbientLight (csColor &c) const = 0;
01032 
01039   virtual csPtr<iFrustumView> CreateFrustumView () = 0;
01040 
01045   virtual csPtr<iObjectWatcher> CreateObjectWatcher () = 0;
01046 
01053   virtual void WantToDie (iMeshWrapper* mesh) = 0;
01054   
01055   // ======================================================================
01056   // Render loop stuff
01057   // ======================================================================
01058   
01063   virtual iRenderLoopManager* GetRenderLoopManager () = 0;
01064   
01078   virtual iRenderLoop* GetCurrentDefaultRenderloop () = 0;
01079 
01086   virtual bool SetCurrentDefaultRenderloop (iRenderLoop* loop) = 0;
01087 };
01088 
01091 #endif // __CS_IENGINE_ENGINE_H__

Generated for Crystal Space by doxygen 1.2.14