CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

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 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 iGraphics3D;
00066 struct iClipper2D;
00067 struct iObject;
00068 struct iObjectWatcher;
00069 struct iCollection;
00070 struct iCollectionList;
00071 struct iDataBuffer;
00072 struct iCamera;
00073 struct iRenderView;
00074 struct iSectorList;
00075 struct iMeshList;
00076 struct iMeshFactoryList;
00077 struct iProgressMeter;
00078 struct iRegionList;
00079 struct iLoaderContext;
00080 struct iCacheManager;
00081 struct iSharedVariableList;
00082 
00089 #define CS_NLIGHT_SHADOWS 1
00090 
00094 #define CS_NLIGHT_STATIC 2
00095 
00099 #define CS_NLIGHT_DYNAMIC 4
00100 
00104 #define CS_NLIGHT_NEARBYSECTORS 8
00105 
00112 #define CS_ENGINE_CACHE_READ 1
00113 
00117 #define CS_ENGINE_CACHE_WRITE 2
00118 
00122 #define CS_ENGINE_CACHE_NOUPDATE 4
00123 
00130 #define CS_RENDPRI_NONE 0
00131 
00135 #define CS_RENDPRI_BACK2FRONT 1
00136 
00140 #define CS_RENDPRI_FRONT2BACK 2
00141 
00143 SCF_VERSION (iEngine, 0, 17, 0);
00144 
00150 struct iEngine : public iBase
00151 {
00153   virtual iObject *QueryObject() = 0;
00154 
00163   virtual bool Prepare (iProgressMeter* meter = NULL) = 0;
00164 
00172   virtual void PrepareTextures () = 0;
00173 
00179   virtual void PrepareMeshes () = 0;
00180 
00187   virtual void ShineLights (iRegion* region = NULL,
00188         iProgressMeter* meter = NULL) = 0;
00189 
00194   virtual int GetTextureFormat () const = 0;
00195 
00200   virtual void SelectRegion (const char* name) = 0;
00205   virtual void SelectRegion (iRegion* region) = 0;
00210   virtual iRegion* GetCurrentRegion () const = 0;
00215   virtual void AddToCurrentRegion (iObject* obj) = 0;
00216 
00218   virtual void DeleteAll () = 0;
00219 
00233   virtual void RegisterRenderPriority (const char* name, long priority,
00234         int rendsort = CS_RENDPRI_NONE, bool do_camera = false) = 0;
00236   virtual long GetRenderPriority (const char* name) const = 0;
00238   virtual void SetRenderPriorityCamera (long priority, bool do_camera) = 0;
00240   virtual bool GetRenderPriorityCamera (const char* name) const = 0;
00242   virtual bool GetRenderPriorityCamera (long priority) const = 0;
00244   virtual int GetRenderPrioritySorting (const char* name) const = 0;
00246   virtual int GetRenderPrioritySorting (long priority) const = 0;
00248   virtual long GetSkyRenderPriority () const = 0;
00250   virtual long GetWallRenderPriority () const = 0;
00252   virtual long GetObjectRenderPriority () const = 0;
00254   virtual long GetAlphaRenderPriority () const = 0;
00256   virtual void ClearRenderPriorities () = 0;
00258   virtual int GetRenderPriorityCount () const = 0;
00260   virtual const char* GetRenderPriorityName (long priority) const = 0;
00261 
00266   virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt) = 0;
00267 
00273   virtual csPtr<iMaterial> CreateBaseMaterial (iTextureWrapper* txt,
00274         int num_layers, iTextureWrapper** wrappers, csTextureLayer* layers) = 0;
00275 
00277   virtual iTextureWrapper* CreateTexture (const char *name,
00278         const char *fileName, csColor *transp, int flags) = 0;
00280   virtual iTextureWrapper* CreateBlackTexture (const char *name,
00281         int w, int h, csColor *iTransp, int iFlags) = 0;
00282 
00284   virtual iMaterialWrapper* CreateMaterial (const char *name,
00285         iTextureWrapper* texture) = 0;
00289   virtual iSector *CreateSector (const char *name) = 0;
00290 
00299   virtual csPtr<iMeshWrapper> CreateSectorWallsMesh (iSector* sector,
00300       const char* name) = 0;
00308   virtual csPtr<iMeshWrapper> CreateThingMesh (iSector* sector,
00309         const char* name) = 0;
00310 
00312   virtual iSectorList* GetSectors () = 0;
00314   virtual iMeshFactoryList* GetMeshFactories () = 0;
00316   virtual iMeshList* GetMeshes () = 0;
00318   virtual iCollectionList* GetCollections () = 0;
00320   virtual iCameraPositionList* GetCameraPositions () = 0;
00322   virtual iTextureList* GetTextureList () const = 0;
00324   virtual iMaterialList* GetMaterialList () const = 0;
00326   virtual iSharedVariableList* GetVariableList () const = 0;
00328   virtual iRegionList* GetRegions () = 0;
00329 
00340   virtual iMaterialWrapper* FindMaterial (const char* name,
00341         iRegion* region = NULL) = 0;
00352   virtual iTextureWrapper* FindTexture (const char* name,
00353         iRegion* region = NULL) = 0;
00364   virtual iSector* FindSector (const char* name,
00365         iRegion* region = NULL) = 0;
00376   virtual iMeshWrapper* FindMeshObject (const char* name,
00377         iRegion* region = NULL) = 0;
00388   virtual iMeshFactoryWrapper* FindMeshFactory (const char* name,
00389         iRegion* region = NULL) = 0;
00400   virtual iCameraPosition* FindCameraPosition (const char* name,
00401         iRegion* region = NULL) = 0;
00412   virtual iCollection* FindCollection (const char* name,
00413         iRegion* region = NULL) = 0;
00414 
00428   virtual void SetLightingCacheMode (int mode) = 0;
00430   virtual int GetLightingCacheMode () = 0;
00431 
00438   virtual void SetFastMeshThresshold (int th) = 0;
00440   virtual int GetFastMeshThresshold () const = 0;
00441 
00452   virtual void SetClearZBuf (bool yesno) = 0;
00453 
00457   virtual bool GetClearZBuf () const = 0;
00459   virtual bool GetDefaultClearZBuf () const = 0;
00460 
00471   virtual void SetClearScreen (bool yesno) = 0;
00472 
00476   virtual bool GetClearScreen () const = 0;
00478   virtual bool GetDefaultClearScreen () const = 0;
00479 
00484   virtual void SetMaxLightmapSize(int w, int h) = 0;
00486   virtual void GetMaxLightmapSize(int& w, int& h) = 0;
00488   virtual void GetDefaultMaxLightmapSize(int& w, int& h) = 0;
00490   virtual bool GetLightmapsRequirePO2 () const = 0;
00492   virtual int GetMaxLightmapAspectRatio () const = 0;
00493   
00501   virtual void ResetWorldSpecificSettings() = 0;  
00502 
00507   virtual csPtr<iCamera> CreateCamera () = 0;
00512   virtual csPtr<iStatLight> CreateLight (const char* name, const csVector3& pos,
00513         float radius, const csColor& color, bool pseudoDyn) = 0;
00515   virtual iStatLight* FindLight (const char *Name, bool RegionOnly = false)
00516     const = 0;
00521   virtual iStatLight* FindLightID (const char* light_id) const = 0;
00526   virtual csPtr<iLightIterator> GetLightIterator (iRegion* region = NULL) = 0;
00527 
00536   virtual csPtr<iDynLight> CreateDynLight (const csVector3& pos, float radius,
00537         const csColor& color) = 0;
00539   virtual void RemoveDynLight (iDynLight*) = 0;
00541   virtual iDynLight* GetFirstDynLight () const = 0;
00542 
00549   virtual int GetBeginDrawFlags () const = 0;
00550 
00554   virtual iClipper2D* GetTopLevelClipper () const = 0;
00555 
00567   virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* classId,
00568         const char* name) = 0;
00569 
00574   virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (iMeshObjectFactory *,
00575         const char* name) = 0;
00576 
00581   virtual csPtr<iMeshFactoryWrapper> CreateMeshFactory (const char* name) = 0;
00582 
00589   virtual csPtr<iLoaderContext> CreateLoaderContext (
00590         iRegion* region = NULL) = 0;
00591 
00596   virtual csPtr<iMeshFactoryWrapper> LoadMeshFactory (
00597         const char* name, const char* loaderClassId,
00598         iDataBuffer* input) = 0;
00599 
00608   virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshFactoryWrapper* factory,
00609         const char* name, iSector* sector = NULL,
00610         const csVector3& pos = csVector3(0, 0, 0)) = 0;
00615   virtual csPtr<iMeshWrapper> CreateMeshWrapper (iMeshObject*,
00616         const char* name, iSector* sector = NULL,
00617         const csVector3& pos = csVector3(0, 0, 0)) = 0;
00629   virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* classid,
00630         const char* name, iSector* sector = NULL,
00631         const csVector3& pos = csVector3(0, 0, 0)) = 0;
00636   virtual csPtr<iMeshWrapper> CreateMeshWrapper (const char* name) = 0;
00637 
00643   virtual csPtr<iMeshWrapper> LoadMeshWrapper (
00644         const char* name, const char* loaderClassId,
00645         iDataBuffer* input, iSector* sector, const csVector3& pos) = 0;
00646 
00654   virtual void Draw (iCamera* c, iClipper2D* clipper) = 0;
00655 
00661   virtual void SetContext (iTextureHandle* ctxt) = 0;
00663   virtual iTextureHandle *GetContext () const = 0;
00664 
00669   virtual void SetAmbientLight (const csColor &) = 0;
00671   virtual void GetAmbientLight (csColor &) const = 0;
00672 
00692   virtual int GetNearbyLights (iSector* sector, const csVector3& pos,
00693         uint32 flags, iLight** lights, int max_num_lights) = 0;
00694 
00714   virtual int GetNearbyLights (iSector* sector, const csBox3& box,
00715         uint32 flags, iLight** lights, int max_num_lights) = 0;
00716 
00722   virtual csPtr<iSectorIterator> GetNearbySectors (iSector* sector,
00723         const csVector3& pos, float radius) = 0;
00724 
00734   virtual csPtr<iObjectIterator> GetNearbyObjects (iSector* sector,
00735     const csVector3& pos, float radius, bool crossPortals = true ) = 0;
00736 
00737 
00746   virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector,
00747     const csVector3& pos) = 0;
00748 
00757   virtual csPtr<iObjectIterator> GetVisibleObjects (iSector* sector,
00758     const csFrustum& frustum) = 0;
00759 
00775   virtual bool RemoveObject (iBase* object) = 0;
00776 
00784   virtual void SetCacheManager (iCacheManager* cache_mgr) = 0;
00785 
00789   virtual iCacheManager* GetCacheManager () = 0;
00790 
00792   virtual void GetDefaultAmbientLight (csColor &c) const = 0;
00793 
00800   virtual csPtr<iFrustumView> CreateFrustumView () = 0;
00801 
00806   virtual csPtr<iObjectWatcher> CreateObjectWatcher () = 0;
00807 
00814   virtual void WantToDie (iMeshWrapper* mesh) = 0;
00815 };
00816 
00819 #endif // __CS_IENGINE_ENGINE_H__

Generated for Crystal Space by doxygen 1.2.14