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
00097 #define CS_ENTITY_BACK2FRONT 64
00098
00099 SCF_VERSION (iMeshDrawCallback, 0, 0, 1);
00100
00109 struct iMeshDrawCallback : public iBase
00110 {
00112 virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0;
00113 };
00114
00115
00116 SCF_VERSION (iMeshWrapper, 0, 1, 17);
00117
00130 struct iMeshWrapper : public iBase
00131 {
00133 virtual csMeshWrapper* GetPrivateObject () = 0;
00135 virtual iMeshObject* GetMeshObject () const = 0;
00137 virtual void SetMeshObject (iMeshObject*) = 0;
00139 virtual iObject *QueryObject () = 0;
00140
00146 virtual void DeferUpdateLighting (int flags, int num_lights) = 0;
00147
00157 virtual void UpdateLighting (iLight** lights, int num_lights) = 0;
00158
00166 virtual iMovable* GetMovable () const = 0;
00167
00180 virtual void PlaceMesh () = 0;
00181
00191 virtual int HitBeamBBox (const csVector3& start, const csVector3& end,
00192 csVector3& isect, float* pr) = 0;
00193
00198 virtual bool HitBeamOutline (const csVector3& start,
00199 const csVector3& end, csVector3& isect, float* pr) = 0;
00200
00205 virtual bool HitBeamObject (const csVector3& start, const csVector3& end,
00206 csVector3& isect, float* pr) = 0;
00211 virtual bool HitBeam (const csVector3& start, const csVector3& end,
00212 csVector3& isect, float* pr) = 0;
00213
00222 virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0;
00223
00225 virtual iMeshDrawCallback* GetDrawCallback () const = 0;
00226
00228 virtual void SetFactory (iMeshFactoryWrapper* factory) = 0;
00229
00246 virtual void SetRenderPriority (long rp) = 0;
00250 virtual long GetRenderPriority () const = 0;
00251
00255 virtual csFlags& GetFlags () = 0;
00256
00260 virtual void SetZBufMode (csZBufMode mode) = 0;
00264 virtual csZBufMode GetZBufMode () const = 0;
00265
00275 virtual void HardTransform (const csReversibleTransform& t) = 0;
00276
00282 virtual void GetWorldBoundingBox (csBox3& cbox) = 0;
00283
00289 virtual void GetTransformedBoundingBox (const csReversibleTransform& trans,
00290 csBox3& cbox) = 0;
00291
00297 virtual float GetScreenBoundingBox (iCamera* camera, csBox2& sbox,
00298 csBox3& cbox) = 0;
00299
00303 virtual iMeshList* GetChildren () = 0;
00308 virtual iMeshWrapper* GetParentContainer () = 0;
00313 virtual void SetParentContainer (iMeshWrapper *) = 0;
00314
00316 virtual void GetRadius (csVector3& rad, csVector3& cent) const = 0;
00317
00324 virtual void Draw (iRenderView* rview) = 0;
00325
00329 virtual bool WantToDie () = 0;
00330 };
00331
00332 SCF_VERSION (iMeshFactoryWrapper, 0, 1, 6);
00333
00345 struct iMeshFactoryWrapper : public iBase
00346 {
00348 virtual csMeshFactoryWrapper* GetPrivateObject () = 0;
00350 virtual iObject *QueryObject () = 0;
00352 virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
00354 virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0;
00364 virtual void HardTransform (const csReversibleTransform& t) = 0;
00369 virtual iMeshWrapper* CreateMeshWrapper () = 0;
00370
00375 virtual iMeshFactoryWrapper* GetParentContainer () const = 0;
00376
00380 virtual iMeshFactoryList* GetChildren () = 0;
00381
00385 virtual csReversibleTransform& GetTransform () = 0;
00386
00390 virtual void SetTransform (const csReversibleTransform& tr) = 0;
00391 };
00392
00393 SCF_VERSION (iMeshList, 0, 0, 1);
00394
00398 struct iMeshList : public iBase
00399 {
00401 virtual int GetCount () const = 0;
00402
00404 virtual iMeshWrapper *Get (int n) const = 0;
00405
00407 virtual int Add (iMeshWrapper *obj) = 0;
00408
00410 virtual bool Remove (iMeshWrapper *obj) = 0;
00411
00413 virtual bool Remove (int n) = 0;
00414
00416 virtual void RemoveAll () = 0;
00417
00419 virtual int Find (iMeshWrapper *obj) const = 0;
00420
00422 virtual iMeshWrapper *FindByName (const char *Name) const = 0;
00423 };
00424
00425 SCF_VERSION (iMeshFactoryList, 0, 0, 1);
00426
00430 struct iMeshFactoryList : public iBase
00431 {
00433 virtual int GetCount () const = 0;
00434
00436 virtual iMeshFactoryWrapper *Get (int n) const = 0;
00437
00439 virtual int Add (iMeshFactoryWrapper *obj) = 0;
00440
00442 virtual bool Remove (iMeshFactoryWrapper *obj) = 0;
00443
00445 virtual bool Remove (int n) = 0;
00446
00448 virtual void RemoveAll () = 0;
00449
00451 virtual int Find (iMeshFactoryWrapper *obj) const = 0;
00452
00454 virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0;
00455 };
00456
00457 #endif // __IENGINE_MESH_H__
00458