CrystalSpace

Public API Reference

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

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   
00543   virtual iShaderVariableContext* GetSVContext() = 0;
00544 };
00545 
00546 SCF_VERSION (iMeshFactoryWrapper, 0, 1, 7);
00547 
00577 struct iMeshFactoryWrapper : public iBase
00578 {
00580   virtual iObject *QueryObject () = 0;
00582   virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
00584   virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0;
00594   virtual void HardTransform (const csReversibleTransform& t) = 0;
00599   virtual iMeshWrapper* CreateMeshWrapper () = 0;
00600 
00605   virtual iMeshFactoryWrapper* GetParentContainer () const = 0;
00610   virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0;
00611 
00615   virtual iMeshFactoryList* GetChildren () = 0;
00616 
00620   virtual csReversibleTransform& GetTransform () = 0;
00621 
00625   virtual void SetTransform (const csReversibleTransform& tr) = 0;
00626 
00633   virtual iLODControl* CreateStaticLOD () = 0;
00634 
00638   virtual void DestroyStaticLOD () = 0;
00639 
00645   virtual iLODControl* GetStaticLOD () = 0;
00646 
00654   virtual void SetStaticLOD (float m, float a) = 0;
00655 
00659   virtual void GetStaticLOD (float& m, float& a) const = 0;
00660 
00665   virtual void AddFactoryToStaticLOD (int lod, iMeshFactoryWrapper* fact) = 0;
00666 
00671   virtual void RemoveFactoryFromStaticLOD (iMeshFactoryWrapper* fact) = 0;
00672 
00684   virtual void SetZBufMode (csZBufMode mode) = 0;
00688   virtual csZBufMode GetZBufMode () const = 0;
00693   virtual void SetZBufModeRecursive (csZBufMode mode) = 0;
00694 
00712   virtual void SetRenderPriority (long rp) = 0;
00716   virtual long GetRenderPriority () const = 0;
00717 
00722   virtual void SetRenderPriorityRecursive (long rp) = 0;
00723 
00727   virtual iShaderVariableContext* GetSVContext() = 0;
00728 };
00729 
00730 SCF_VERSION (iMeshList, 0, 0, 1);
00731 
00746 struct iMeshList : public iBase
00747 {
00749   virtual int GetCount () const = 0;
00750 
00752   virtual iMeshWrapper *Get (int n) const = 0;
00753 
00755   virtual int Add (iMeshWrapper *obj) = 0;
00756 
00758   virtual bool Remove (iMeshWrapper *obj) = 0;
00759 
00761   virtual bool Remove (int n) = 0;
00762 
00764   virtual void RemoveAll () = 0;
00765 
00767   virtual int Find (iMeshWrapper *obj) const = 0;
00768 
00774   virtual iMeshWrapper *FindByName (const char *Name) const = 0;
00775 };
00776 
00777 SCF_VERSION (iMeshFactoryList, 0, 0, 1);
00778 
00792 struct iMeshFactoryList : public iBase
00793 {
00795   virtual int GetCount () const = 0;
00796 
00798   virtual iMeshFactoryWrapper *Get (int n) const = 0;
00799 
00801   virtual int Add (iMeshFactoryWrapper *obj) = 0;
00802 
00804   virtual bool Remove (iMeshFactoryWrapper *obj) = 0;
00805 
00807   virtual bool Remove (int n) = 0;
00808 
00810   virtual void RemoveAll () = 0;
00811 
00813   virtual int Find (iMeshFactoryWrapper *obj) const = 0;
00814 
00816   virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0;
00817 };
00818 
00819 SCF_VERSION (iMeshWrapperIterator, 0, 1, 0);
00820 
00830 struct iMeshWrapperIterator : public iBase
00831 {
00833   virtual iMeshWrapper* Next () = 0;
00834 
00836   virtual void Reset () = 0;
00837 
00839   virtual bool HasNext () const = 0;
00840 };
00841 
00842 
00845 #endif // __CS_IENGINE_MESH_H__
00846 

Generated for Crystal Space by doxygen 1.3.9.1