CrystalSpace

Public API Reference

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

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 class csMeshWrapper;
00041 class csMeshFactoryWrapper;
00042 struct iMeshFactoryWrapper;
00043 struct iRenderView;
00044 struct iMovable;
00045 struct iLight;
00046 struct iLightingInfo;
00047 struct iShadowReceiver;
00048 struct iObject;
00049 class csFlags;
00050 
00061 #define CS_ENTITY_CONVEX 1
00062 
00071 #define CS_ENTITY_DETAIL 2
00072 
00081 #define CS_ENTITY_CAMERA 4
00082 
00088 #define CS_ENTITY_INVISIBLE 8
00089 
00095 #define CS_ENTITY_NOSHADOWS 16
00096 
00102 #define CS_ENTITY_NOLIGHTING 32
00103 
00105 SCF_VERSION (iMeshDrawCallback, 0, 0, 1);
00106 
00115 struct iMeshDrawCallback : public iBase
00116 {
00121   virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0;
00122 };
00123 
00124 
00125 SCF_VERSION (iMeshWrapper, 0, 4, 0);
00126 
00139 struct iMeshWrapper : public iBase
00140 {
00142   virtual csMeshWrapper* GetPrivateObject () = 0;
00148   virtual iObject *QueryObject () = 0;
00149 
00151   virtual iMeshObject* GetMeshObject () const = 0;
00153   virtual void SetMeshObject (iMeshObject*) = 0;
00154 
00161   virtual iLightingInfo* GetLightingInfo () const = 0;
00168   virtual iShadowReceiver* GetShadowReceiver () const = 0;
00169 
00171   virtual iMeshFactoryWrapper *GetFactory () const = 0;
00173   virtual void SetFactory (iMeshFactoryWrapper* factory) = 0;
00174 
00183   virtual void DeferUpdateLighting (int flags, int num_lights) = 0;
00184 
00197   virtual void UpdateLighting (iLight** lights, int num_lights) = 0;
00198 
00206   virtual iMovable* GetMovable () const = 0;
00207 
00225   virtual void PlaceMesh () = 0;
00226 
00236   virtual int HitBeamBBox (const csVector3& start, const csVector3& end,
00237                 csVector3& isect, float* pr) = 0;
00238 
00243   virtual bool HitBeamOutline (const csVector3& start,
00244         const csVector3& end, csVector3& isect, float* pr) = 0;
00245 
00251   virtual bool HitBeamObject (const csVector3& start, const csVector3& end,
00252         csVector3& isect, float* pr) = 0;
00257   virtual bool HitBeam (const csVector3& start, const csVector3& end,
00258         csVector3& isect, float* pr) = 0;
00259 
00268   virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0;
00269 
00273   virtual void RemoveDrawCallback (iMeshDrawCallback* cb) = 0;
00274 
00276   virtual int GetDrawCallbackCount () const = 0;
00277 
00279   virtual iMeshDrawCallback* GetDrawCallback (int idx) const = 0;
00280 
00297   virtual void SetRenderPriority (long rp) = 0;
00301   virtual long GetRenderPriority () const = 0;
00302 
00316   virtual csFlags& GetFlags () = 0;
00317 
00328   virtual void SetZBufMode (csZBufMode mode) = 0;
00332   virtual csZBufMode GetZBufMode () const = 0;
00333 
00348   virtual void HardTransform (const csReversibleTransform& t) = 0;
00349 
00355   virtual void GetWorldBoundingBox (csBox3& cbox) = 0;
00356 
00362   virtual void GetTransformedBoundingBox (const csReversibleTransform& trans,
00363         csBox3& cbox) = 0;
00364 
00370   virtual float GetScreenBoundingBox (iCamera* camera, csBox2& sbox,
00371         csBox3& cbox) = 0;
00372 
00378   virtual iMeshList* GetChildren () = 0;
00384   virtual iMeshWrapper* GetParentContainer () = 0;
00389   virtual void SetParentContainer (iMeshWrapper *) = 0;
00390 
00392   virtual void GetRadius (csVector3& rad, csVector3& cent) const = 0;
00393 
00400   virtual void Draw (iRenderView* rview) = 0;
00401 
00402 #ifdef CS_USE_NEW_RENDERER
00403 
00408   virtual csRenderMesh *GetRenderMesh (iRenderView* rview) = 0;
00412   virtual void DrawShadow (iRenderView* rview, iLight *light) = 0;
00416   virtual void DrawLight (iRenderView* rview, iLight *light) = 0;
00417 
00421   virtual void CastHardwareShadow (bool castShadow) = 0;
00425   virtual void SetDrawAfterShadow (bool drawAfter) = 0;
00429   virtual bool GetDrawAfterShadow () = 0;
00430 #endif
00431 };
00432 
00433 SCF_VERSION (iMeshFactoryWrapper, 0, 1, 6);
00434 
00446 struct iMeshFactoryWrapper : public iBase
00447 {
00449   virtual iObject *QueryObject () = 0;
00451   virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
00453   virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0;
00463   virtual void HardTransform (const csReversibleTransform& t) = 0;
00468   virtual iMeshWrapper* CreateMeshWrapper () = 0;
00469 
00474   virtual iMeshFactoryWrapper* GetParentContainer () const = 0;
00479   virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0;
00480 
00484   virtual iMeshFactoryList* GetChildren () = 0;
00485 
00489   virtual csReversibleTransform& GetTransform () = 0;
00490 
00494   virtual void SetTransform (const csReversibleTransform& tr) = 0;
00495 };
00496 
00497 SCF_VERSION (iMeshList, 0, 0, 1);
00498 
00502 struct iMeshList : public iBase
00503 {
00505   virtual int GetCount () const = 0;
00506 
00508   virtual iMeshWrapper *Get (int n) const = 0;
00509 
00511   virtual int Add (iMeshWrapper *obj) = 0;
00512 
00514   virtual bool Remove (iMeshWrapper *obj) = 0;
00515 
00517   virtual bool Remove (int n) = 0;
00518 
00520   virtual void RemoveAll () = 0;
00521 
00523   virtual int Find (iMeshWrapper *obj) const = 0;
00524 
00530   virtual iMeshWrapper *FindByName (const char *Name) const = 0;
00531 };
00532 
00533 SCF_VERSION (iMeshFactoryList, 0, 0, 1);
00534 
00538 struct iMeshFactoryList : public iBase
00539 {
00541   virtual int GetCount () const = 0;
00542 
00544   virtual iMeshFactoryWrapper *Get (int n) const = 0;
00545 
00547   virtual int Add (iMeshFactoryWrapper *obj) = 0;
00548 
00550   virtual bool Remove (iMeshFactoryWrapper *obj) = 0;
00551 
00553   virtual bool Remove (int n) = 0;
00554 
00556   virtual void RemoveAll () = 0;
00557 
00559   virtual int Find (iMeshFactoryWrapper *obj) const = 0;
00560 
00562   virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0;
00563 };
00564 
00567 #endif // __CS_IENGINE_MESH_H__
00568 

Generated for Crystal Space by doxygen 1.2.14