CrystalSpace

Public API Reference

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

iengine/mesh.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2000-2001 by Jorrit Tyberghein
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_IENGINE_MESH_H__
00020 #define __CS_IENGINE_MESH_H__
00021 
00028 #include "csutil/scf.h"
00029 #include "csgeom/box.h"
00030 #include "iutil/eventh.h"
00031 #include "iutil/comp.h"
00032 #include "ivideo/graph3d.h"
00033 
00034 struct iMeshObject;
00035 struct iCamera;
00036 struct iMeshObjectFactory;
00037 struct iMeshWrapper;
00038 struct iMeshList;
00039 struct iMeshFactoryList;
00040 struct iMeshFactoryWrapper;
00041 struct iRenderView;
00042 struct iMovable;
00043 struct iLODControl;
00044 struct iLight;
00045 struct iLightingInfo;
00046 struct iShadowReceiver;
00047 struct iObject;
00048 struct iPortalContainer;
00049 struct csRenderMesh;
00050 class csFlags;
00051 
00062 #define CS_ENTITY_DETAIL 2
00063 
00072 #define CS_ENTITY_CAMERA 4
00073 
00079 #define CS_ENTITY_INVISIBLE 8
00080 
00086 #define CS_ENTITY_NOSHADOWS 16
00087 
00093 #define CS_ENTITY_NOLIGHTING 32
00094 
00104 #define CS_LIGHTINGUPDATE_SORTRELEVANCE 1
00105 
00112 #define CS_LIGHTINGUPDATE_ALWAYSUPDATE 2
00113 
00116 SCF_VERSION (iMeshDrawCallback, 0, 0, 1);
00117 
00126 struct iMeshDrawCallback : public iBase
00127 {
00132   virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0;
00133 };
00134 
00135 
00136 SCF_VERSION (iMeshWrapper, 0, 8, 0);
00137 
00150 struct iMeshWrapper : public iBase
00151 {
00157   virtual iObject *QueryObject () = 0;
00158 
00160   virtual iMeshObject* GetMeshObject () const = 0;
00162   virtual void SetMeshObject (iMeshObject*) = 0;
00167   virtual iPortalContainer* GetPortalContainer () const = 0;
00168 
00175   virtual iLightingInfo* GetLightingInfo () const = 0;
00176 
00183   virtual iShadowReceiver* GetShadowReceiver () const = 0;
00184 
00189   virtual uint GetVisibilityNumber () const = 0;
00190 
00192   virtual iMeshFactoryWrapper *GetFactory () const = 0;
00194   virtual void SetFactory (iMeshFactoryWrapper* factory) = 0;
00195 
00210   virtual void SetLightingUpdate (int flags, int num_lights) = 0;
00211 
00219   virtual iMovable* GetMovable () const = 0;
00220 
00238   virtual void PlaceMesh () = 0;
00239 
00249   virtual int HitBeamBBox (const csVector3& start, const csVector3& end,
00250                 csVector3& isect, float* pr) = 0;
00251 
00256   virtual bool HitBeamOutline (const csVector3& start,
00257         const csVector3& end, csVector3& isect, float* pr) = 0;
00258 
00264   virtual bool HitBeamObject (const csVector3& start, const csVector3& end,
00265         csVector3& isect, float* pr, int* polygon_idx = 0) = 0;
00270   virtual bool HitBeam (const csVector3& start, const csVector3& end,
00271         csVector3& isect, float* pr) = 0;
00272 
00281   virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0;
00282 
00286   virtual void RemoveDrawCallback (iMeshDrawCallback* cb) = 0;
00287 
00289   virtual int GetDrawCallbackCount () const = 0;
00290 
00292   virtual iMeshDrawCallback* GetDrawCallback (int idx) const = 0;
00293 
00310   virtual void SetRenderPriority (long rp) = 0;
00314   virtual long GetRenderPriority () const = 0;
00315 
00329   virtual csFlags& GetFlags () = 0;
00330 
00341   virtual void SetZBufMode (csZBufMode mode) = 0;
00345   virtual csZBufMode GetZBufMode () const = 0;
00346 
00361   virtual void HardTransform (const csReversibleTransform& t) = 0;
00362 
00368   virtual void GetWorldBoundingBox (csBox3& cbox) = 0;
00369 
00375   virtual void GetTransformedBoundingBox (const csReversibleTransform& trans,
00376         csBox3& cbox) = 0;
00377 
00383   virtual float GetScreenBoundingBox (iCamera* camera, csBox2& sbox,
00384         csBox3& cbox) = 0;
00385 
00391   virtual iMeshList* GetChildren () = 0;
00397   virtual iMeshWrapper* GetParentContainer () = 0;
00402   virtual void SetParentContainer (iMeshWrapper *) = 0;
00403 
00405   virtual void GetRadius (csVector3& rad, csVector3& cent) const = 0;
00406 
00413   virtual void Draw (iRenderView* rview) = 0;
00414 
00421   virtual iLODControl* CreateStaticLOD () = 0;
00422 
00427   virtual void DestroyStaticLOD () = 0;
00428 
00434   virtual iLODControl* GetStaticLOD () = 0;
00435 
00440   virtual void AddMeshToStaticLOD (int lod, iMeshWrapper* mesh) = 0;
00441 
00446   virtual void RemoveMeshFromStaticLOD (iMeshWrapper* mesh) = 0;
00447 
00451   virtual csRenderMesh** GetRenderMeshes (int& n) = 0;
00455   virtual void DrawShadow (iRenderView* rview, iLight *light) = 0;
00459   virtual void DrawLight (iRenderView* rview, iLight *light) = 0;
00460 
00464   virtual void CastHardwareShadow (bool castShadow) = 0;
00468   virtual void SetDrawAfterShadow (bool drawAfter) = 0;
00472   virtual bool GetDrawAfterShadow () = 0;
00473 };
00474 
00475 SCF_VERSION (iMeshFactoryWrapper, 0, 1, 7);
00476 
00488 struct iMeshFactoryWrapper : public iBase
00489 {
00491   virtual iObject *QueryObject () = 0;
00493   virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
00495   virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0;
00505   virtual void HardTransform (const csReversibleTransform& t) = 0;
00510   virtual iMeshWrapper* CreateMeshWrapper () = 0;
00511 
00516   virtual iMeshFactoryWrapper* GetParentContainer () const = 0;
00521   virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0;
00522 
00526   virtual iMeshFactoryList* GetChildren () = 0;
00527 
00531   virtual csReversibleTransform& GetTransform () = 0;
00532 
00536   virtual void SetTransform (const csReversibleTransform& tr) = 0;
00537 
00544   virtual iLODControl* CreateStaticLOD () = 0;
00545 
00549   virtual void DestroyStaticLOD () = 0;
00550 
00556   virtual iLODControl* GetStaticLOD () = 0;
00557 
00565   virtual void SetStaticLOD (float m, float a) = 0;
00566 
00570   virtual void GetStaticLOD (float& m, float& a) const = 0;
00571 
00576   virtual void AddFactoryToStaticLOD (int lod, iMeshFactoryWrapper* fact) = 0;
00577 
00582   virtual void RemoveFactoryFromStaticLOD (iMeshFactoryWrapper* fact) = 0;
00583 };
00584 
00585 SCF_VERSION (iMeshList, 0, 0, 1);
00586 
00590 struct iMeshList : public iBase
00591 {
00593   virtual int GetCount () const = 0;
00594 
00596   virtual iMeshWrapper *Get (int n) const = 0;
00597 
00599   virtual int Add (iMeshWrapper *obj) = 0;
00600 
00602   virtual bool Remove (iMeshWrapper *obj) = 0;
00603 
00605   virtual bool Remove (int n) = 0;
00606 
00608   virtual void RemoveAll () = 0;
00609 
00611   virtual int Find (iMeshWrapper *obj) const = 0;
00612 
00618   virtual iMeshWrapper *FindByName (const char *Name) const = 0;
00619 };
00620 
00621 SCF_VERSION (iMeshFactoryList, 0, 0, 1);
00622 
00626 struct iMeshFactoryList : public iBase
00627 {
00629   virtual int GetCount () const = 0;
00630 
00632   virtual iMeshFactoryWrapper *Get (int n) const = 0;
00633 
00635   virtual int Add (iMeshFactoryWrapper *obj) = 0;
00636 
00638   virtual bool Remove (iMeshFactoryWrapper *obj) = 0;
00639 
00641   virtual bool Remove (int n) = 0;
00642 
00644   virtual void RemoveAll () = 0;
00645 
00647   virtual int Find (iMeshFactoryWrapper *obj) const = 0;
00648 
00650   virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0;
00651 };
00652 
00653 SCF_VERSION (iMeshWrapperIterator, 0, 1, 0);
00654 
00658 struct iMeshWrapperIterator : public iBase
00659 {
00661   virtual iMeshWrapper* Next () = 0;
00662 
00664   virtual void Reset () = 0;
00665 
00667   virtual bool HasNext () const = 0;
00668 };
00669 
00670 
00673 #endif // __CS_IENGINE_MESH_H__
00674 

Generated for Crystal Space by doxygen 1.2.18