00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __IENGINE_MESH_H__
00020 #define __IENGINE_MESH_H__
00021
00022 #include "csutil/scf.h"
00023 #include "csgeom/box.h"
00024 #include "iutil/eventh.h"
00025 #include "iutil/comp.h"
00026 #include "ivideo/graph3d.h"
00027
00028 struct iMeshObject;
00029 struct iCamera;
00030 struct iMeshObjectFactory;
00031 struct iMeshWrapper;
00032 struct iMeshList;
00033 struct iMeshFactoryList;
00034 class csMeshWrapper;
00035 class csMeshFactoryWrapper;
00036 struct iMeshFactoryWrapper;
00037 struct iRenderView;
00038 struct iMovable;
00039 struct iLight;
00040 struct iObject;
00041 class csFlags;
00042
00050 #define CS_ENTITY_CONVEX 1
00051
00059 #define CS_ENTITY_DETAIL 2
00060
00066 #define CS_ENTITY_CAMERA 4
00067
00073 #define CS_ENTITY_INVISIBLE 8
00074
00080 #define CS_ENTITY_NOSHADOWS 16
00081
00087 #define CS_ENTITY_NOLIGHTING 32
00088
00089 SCF_VERSION (iMeshDrawCallback, 0, 0, 1);
00090
00099 struct iMeshDrawCallback : public iBase
00100 {
00102 virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0;
00103 };
00104
00105
00106 SCF_VERSION (iMeshWrapper, 0, 1, 18);
00107
00120 struct iMeshWrapper : public iBase
00121 {
00123 virtual csMeshWrapper* GetPrivateObject () = 0;
00125 virtual iObject *QueryObject () = 0;
00126
00128 virtual iMeshObject* GetMeshObject () const = 0;
00130 virtual void SetMeshObject (iMeshObject*) = 0;
00131
00133 virtual iMeshFactoryWrapper *GetFactory () const = 0;
00135 virtual void SetFactory (iMeshFactoryWrapper* factory) = 0;
00136
00142 virtual void DeferUpdateLighting (int flags, int num_lights) = 0;
00143
00153 virtual void UpdateLighting (iLight** lights, int num_lights) = 0;
00154
00162 virtual iMovable* GetMovable () const = 0;
00163
00176 virtual void PlaceMesh () = 0;
00177
00187 virtual int HitBeamBBox (const csVector3& start, const csVector3& end,
00188 csVector3& isect, float* pr) = 0;
00189
00194 virtual bool HitBeamOutline (const csVector3& start,
00195 const csVector3& end, csVector3& isect, float* pr) = 0;
00196
00201 virtual bool HitBeamObject (const csVector3& start, const csVector3& end,
00202 csVector3& isect, float* pr) = 0;
00207 virtual bool HitBeam (const csVector3& start, const csVector3& end,
00208 csVector3& isect, float* pr) = 0;
00209
00218 virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0;
00219
00221 virtual iMeshDrawCallback* GetDrawCallback () const = 0;
00222
00239 virtual void SetRenderPriority (long rp) = 0;
00243 virtual long GetRenderPriority () const = 0;
00244
00258 virtual csFlags& GetFlags () = 0;
00259
00270 virtual void SetZBufMode (csZBufMode mode) = 0;
00274 virtual csZBufMode GetZBufMode () const = 0;
00275
00285 virtual void HardTransform (const csReversibleTransform& t) = 0;
00286
00292 virtual void GetWorldBoundingBox (csBox3& cbox) = 0;
00293
00299 virtual void GetTransformedBoundingBox (const csReversibleTransform& trans,
00300 csBox3& cbox) = 0;
00301
00307 virtual float GetScreenBoundingBox (iCamera* camera, csBox2& sbox,
00308 csBox3& cbox) = 0;
00309
00313 virtual iMeshList* GetChildren () = 0;
00318 virtual iMeshWrapper* GetParentContainer () = 0;
00323 virtual void SetParentContainer (iMeshWrapper *) = 0;
00324
00326 virtual void GetRadius (csVector3& rad, csVector3& cent) const = 0;
00327
00334 virtual void Draw (iRenderView* rview) = 0;
00335
00339 virtual bool WantToDie () = 0;
00340 };
00341
00342 SCF_VERSION (iMeshFactoryWrapper, 0, 1, 6);
00343
00355 struct iMeshFactoryWrapper : public iBase
00356 {
00358 virtual iObject *QueryObject () = 0;
00360 virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
00362 virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0;
00372 virtual void HardTransform (const csReversibleTransform& t) = 0;
00377 virtual iMeshWrapper* CreateMeshWrapper () = 0;
00378
00383 virtual iMeshFactoryWrapper* GetParentContainer () const = 0;
00388 virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0;
00389
00393 virtual iMeshFactoryList* GetChildren () = 0;
00394
00398 virtual csReversibleTransform& GetTransform () = 0;
00399
00403 virtual void SetTransform (const csReversibleTransform& tr) = 0;
00404 };
00405
00406 SCF_VERSION (iMeshList, 0, 0, 1);
00407
00411 struct iMeshList : public iBase
00412 {
00414 virtual int GetCount () const = 0;
00415
00417 virtual iMeshWrapper *Get (int n) const = 0;
00418
00420 virtual int Add (iMeshWrapper *obj) = 0;
00421
00423 virtual bool Remove (iMeshWrapper *obj) = 0;
00424
00426 virtual bool Remove (int n) = 0;
00427
00429 virtual void RemoveAll () = 0;
00430
00432 virtual int Find (iMeshWrapper *obj) const = 0;
00433
00435 virtual iMeshWrapper *FindByName (const char *Name) const = 0;
00436 };
00437
00438 SCF_VERSION (iMeshFactoryList, 0, 0, 1);
00439
00443 struct iMeshFactoryList : public iBase
00444 {
00446 virtual int GetCount () const = 0;
00447
00449 virtual iMeshFactoryWrapper *Get (int n) const = 0;
00450
00452 virtual int Add (iMeshFactoryWrapper *obj) = 0;
00453
00455 virtual bool Remove (iMeshFactoryWrapper *obj) = 0;
00456
00458 virtual bool Remove (int n) = 0;
00459
00461 virtual void RemoveAll () = 0;
00462
00464 virtual int Find (iMeshFactoryWrapper *obj) const = 0;
00465
00467 virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0;
00468 };
00469
00470 #endif // __IENGINE_MESH_H__
00471