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 iShadowCaster;
00048 struct iObject;
00049 struct iPortalContainer;
00050 struct csRenderMesh;
00051 class csFlags;
00052 
00063 #define CS_ENTITY_DETAIL 2
00064 
00073 #define CS_ENTITY_CAMERA 4
00074 
00082 #define CS_ENTITY_INVISIBLEMESH 8
00083 
00090 #define CS_ENTITY_INVISIBLE (CS_ENTITY_INVISIBLEMESH+CS_ENTITY_NOHITBEAM)
00091 
00097 #define CS_ENTITY_NOSHADOWS 16
00098 
00104 #define CS_ENTITY_NOLIGHTING 32
00105 
00110 #define CS_ENTITY_NOHITBEAM 64
00111 
00122 #define CS_LIGHTINGUPDATE_SORTRELEVANCE 1
00123 
00130 #define CS_LIGHTINGUPDATE_ALWAYSUPDATE 2
00131 
00134 SCF_VERSION (iMeshDrawCallback, 0, 0, 1);
00135 
00144 struct iMeshDrawCallback : public iBase
00145 {
00150   virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0;
00151 };
00152 
00153 
00154 SCF_VERSION (iMeshWrapper, 0, 8, 1);
00155 
00191 struct iMeshWrapper : public iBase
00192 {
00198   virtual iObject *QueryObject () = 0;
00199 
00201   virtual iMeshObject* GetMeshObject () const = 0;
00203   virtual void SetMeshObject (iMeshObject*) = 0;
00208   virtual iPortalContainer* GetPortalContainer () const = 0;
00209 
00216   virtual iLightingInfo* GetLightingInfo () const = 0;
00217 
00229   virtual iShadowReceiver* GetShadowReceiver () = 0;
00230 
00241   virtual iShadowCaster* GetShadowCaster () = 0;
00242 
00247   virtual uint GetVisibilityNumber () const = 0;
00248 
00250   virtual iMeshFactoryWrapper *GetFactory () const = 0;
00252   virtual void SetFactory (iMeshFactoryWrapper* factory) = 0;
00253 
00268   virtual void SetLightingUpdate (int flags, int num_lights) = 0;
00269 
00277   virtual iMovable* GetMovable () const = 0;
00278 
00296   virtual void PlaceMesh () = 0;
00297 
00307   virtual int HitBeamBBox (const csVector3& start, const csVector3& end,
00308                 csVector3& isect, float* pr) = 0;
00309 
00314   virtual bool HitBeamOutline (const csVector3& start,
00315         const csVector3& end, csVector3& isect, float* pr) = 0;
00316 
00322   virtual bool HitBeamObject (const csVector3& start, const csVector3& end,
00323         csVector3& isect, float* pr, int* polygon_idx = 0) = 0;
00328   virtual bool HitBeam (const csVector3& start, const csVector3& end,
00329         csVector3& isect, float* pr) = 0;
00330 
00339   virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0;
00340 
00344   virtual void RemoveDrawCallback (iMeshDrawCallback* cb) = 0;
00345 
00347   virtual int GetDrawCallbackCount () const = 0;
00348 
00350   virtual iMeshDrawCallback* GetDrawCallback (int idx) const = 0;
00351 
00368   virtual void SetRenderPriority (long rp) = 0;
00372   virtual long GetRenderPriority () const = 0;
00373 
00378   virtual void SetRenderPriorityRecursive (long rp) = 0;
00379 
00397   virtual csFlags& GetFlags () = 0;
00398 
00402   virtual void SetFlagsRecursive (uint32 mask, uint32 flags) = 0;
00403 
00414   virtual void SetZBufMode (csZBufMode mode) = 0;
00418   virtual csZBufMode GetZBufMode () const = 0;
00423   virtual void SetZBufModeRecursive (csZBufMode mode) = 0;
00424 
00439   virtual void HardTransform (const csReversibleTransform& t) = 0;
00440 
00446   virtual void GetWorldBoundingBox (csBox3& cbox) = 0;
00447 
00453   virtual void GetTransformedBoundingBox (const csReversibleTransform& trans,
00454         csBox3& cbox) = 0;
00455 
00461   virtual float GetScreenBoundingBox (iCamera* camera, csBox2& sbox,
00462         csBox3& cbox) = 0;
00463 
00469   virtual iMeshList* GetChildren () = 0;
00475   virtual iMeshWrapper* GetParentContainer () = 0;
00480   virtual void SetParentContainer (iMeshWrapper *) = 0;
00481 
00483   virtual void GetRadius (csVector3& rad, csVector3& cent) const = 0;
00484 
00491   virtual iLODControl* CreateStaticLOD () = 0;
00492 
00497   virtual void DestroyStaticLOD () = 0;
00498 
00504   virtual iLODControl* GetStaticLOD () = 0;
00505 
00510   virtual void AddMeshToStaticLOD (int lod, iMeshWrapper* mesh) = 0;
00511 
00516   virtual void RemoveMeshFromStaticLOD (iMeshWrapper* mesh) = 0;
00517 
00521   virtual void DrawShadow (iRenderView* rview, iLight *light) = 0;
00525   virtual void DrawLight (iRenderView* rview, iLight *light) = 0;
00526 
00530   virtual void CastHardwareShadow (bool castShadow) = 0;
00534   virtual void SetDrawAfterShadow (bool drawAfter) = 0;
00538   virtual bool GetDrawAfterShadow () = 0;
00539 };
00540 
00541 SCF_VERSION (iMeshFactoryWrapper, 0, 1, 7);
00542 
00572 struct iMeshFactoryWrapper : public iBase
00573 {
00575   virtual iObject *QueryObject () = 0;
00577   virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
00579   virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0;
00589   virtual void HardTransform (const csReversibleTransform& t) = 0;
00594   virtual iMeshWrapper* CreateMeshWrapper () = 0;
00595 
00600   virtual iMeshFactoryWrapper* GetParentContainer () const = 0;
00605   virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0;
00606 
00610   virtual iMeshFactoryList* GetChildren () = 0;
00611 
00615   virtual csReversibleTransform& GetTransform () = 0;
00616 
00620   virtual void SetTransform (const csReversibleTransform& tr) = 0;
00621 
00628   virtual iLODControl* CreateStaticLOD () = 0;
00629 
00633   virtual void DestroyStaticLOD () = 0;
00634 
00640   virtual iLODControl* GetStaticLOD () = 0;
00641 
00649   virtual void SetStaticLOD (float m, float a) = 0;
00650 
00654   virtual void GetStaticLOD (float& m, float& a) const = 0;
00655 
00660   virtual void AddFactoryToStaticLOD (int lod, iMeshFactoryWrapper* fact) = 0;
00661 
00666   virtual void RemoveFactoryFromStaticLOD (iMeshFactoryWrapper* fact) = 0;
00667 };
00668 
00669 SCF_VERSION (iMeshList, 0, 0, 1);
00670 
00685 struct iMeshList : public iBase
00686 {
00688   virtual int GetCount () const = 0;
00689 
00691   virtual iMeshWrapper *Get (int n) const = 0;
00692 
00694   virtual int Add (iMeshWrapper *obj) = 0;
00695 
00697   virtual bool Remove (iMeshWrapper *obj) = 0;
00698 
00700   virtual bool Remove (int n) = 0;
00701 
00703   virtual void RemoveAll () = 0;
00704 
00706   virtual int Find (iMeshWrapper *obj) const = 0;
00707 
00713   virtual iMeshWrapper *FindByName (const char *Name) const = 0;
00714 };
00715 
00716 SCF_VERSION (iMeshFactoryList, 0, 0, 1);
00717 
00731 struct iMeshFactoryList : public iBase
00732 {
00734   virtual int GetCount () const = 0;
00735 
00737   virtual iMeshFactoryWrapper *Get (int n) const = 0;
00738 
00740   virtual int Add (iMeshFactoryWrapper *obj) = 0;
00741 
00743   virtual bool Remove (iMeshFactoryWrapper *obj) = 0;
00744 
00746   virtual bool Remove (int n) = 0;
00747 
00749   virtual void RemoveAll () = 0;
00750 
00752   virtual int Find (iMeshFactoryWrapper *obj) const = 0;
00753 
00755   virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0;
00756 };
00757 
00758 SCF_VERSION (iMeshWrapperIterator, 0, 1, 0);
00759 
00769 struct iMeshWrapperIterator : public iBase
00770 {
00772   virtual iMeshWrapper* Next () = 0;
00773 
00775   virtual void Reset () = 0;
00776 
00778   virtual bool HasNext () const = 0;
00779 };
00780 
00781 
00784 #endif // __CS_IENGINE_MESH_H__
00785 

Generated for Crystal Space by doxygen 1.2.18