00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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 iObject;
00048 class csFlags;
00049 class csRenderMesh;
00050
00061 #define CS_ENTITY_DETAIL 2
00062
00071 #define CS_ENTITY_CAMERA 4
00072
00078 #define CS_ENTITY_INVISIBLE 8
00079
00085 #define CS_ENTITY_NOSHADOWS 16
00086
00092 #define CS_ENTITY_NOLIGHTING 32
00093
00095 SCF_VERSION (iMeshDrawCallback, 0, 0, 1);
00096
00105 struct iMeshDrawCallback : public iBase
00106 {
00111 virtual bool BeforeDrawing (iMeshWrapper* spr, iRenderView* rview) = 0;
00112 };
00113
00114
00115 SCF_VERSION (iMeshWrapper, 0, 7, 0);
00116
00129 struct iMeshWrapper : public iBase
00130 {
00136 virtual iObject *QueryObject () = 0;
00137
00139 virtual iMeshObject* GetMeshObject () const = 0;
00141 virtual void SetMeshObject (iMeshObject*) = 0;
00142
00149 virtual iLightingInfo* GetLightingInfo () const = 0;
00150
00157 virtual iShadowReceiver* GetShadowReceiver () const = 0;
00158
00163 virtual uint GetVisibilityNumber () const = 0;
00164
00166 virtual iMeshFactoryWrapper *GetFactory () const = 0;
00168 virtual void SetFactory (iMeshFactoryWrapper* factory) = 0;
00169
00178 virtual void DeferUpdateLighting (int flags, int num_lights) = 0;
00179
00192 virtual void UpdateLighting (iLight** lights, int num_lights) = 0;
00193
00201 virtual iMovable* GetMovable () const = 0;
00202
00220 virtual void PlaceMesh () = 0;
00221
00231 virtual int HitBeamBBox (const csVector3& start, const csVector3& end,
00232 csVector3& isect, float* pr) = 0;
00233
00238 virtual bool HitBeamOutline (const csVector3& start,
00239 const csVector3& end, csVector3& isect, float* pr) = 0;
00240
00246 virtual bool HitBeamObject (const csVector3& start, const csVector3& end,
00247 csVector3& isect, float* pr) = 0;
00252 virtual bool HitBeam (const csVector3& start, const csVector3& end,
00253 csVector3& isect, float* pr) = 0;
00254
00263 virtual void SetDrawCallback (iMeshDrawCallback* cb) = 0;
00264
00268 virtual void RemoveDrawCallback (iMeshDrawCallback* cb) = 0;
00269
00271 virtual int GetDrawCallbackCount () const = 0;
00272
00274 virtual iMeshDrawCallback* GetDrawCallback (int idx) const = 0;
00275
00292 virtual void SetRenderPriority (long rp) = 0;
00296 virtual long GetRenderPriority () const = 0;
00297
00311 virtual csFlags& GetFlags () = 0;
00312
00323 virtual void SetZBufMode (csZBufMode mode) = 0;
00327 virtual csZBufMode GetZBufMode () const = 0;
00328
00343 virtual void HardTransform (const csReversibleTransform& t) = 0;
00344
00350 virtual void GetWorldBoundingBox (csBox3& cbox) = 0;
00351
00357 virtual void GetTransformedBoundingBox (const csReversibleTransform& trans,
00358 csBox3& cbox) = 0;
00359
00365 virtual float GetScreenBoundingBox (iCamera* camera, csBox2& sbox,
00366 csBox3& cbox) = 0;
00367
00373 virtual iMeshList* GetChildren () = 0;
00379 virtual iMeshWrapper* GetParentContainer () = 0;
00384 virtual void SetParentContainer (iMeshWrapper *) = 0;
00385
00387 virtual void GetRadius (csVector3& rad, csVector3& cent) const = 0;
00388
00395 virtual void Draw (iRenderView* rview) = 0;
00396
00403 virtual iLODControl* CreateStaticLOD () = 0;
00404
00409 virtual void DestroyStaticLOD () = 0;
00410
00416 virtual iLODControl* GetStaticLOD () = 0;
00417
00422 virtual void AddMeshToStaticLOD (int lod, iMeshWrapper* mesh) = 0;
00423
00428 virtual void RemoveMeshFromStaticLOD (iMeshWrapper* mesh) = 0;
00429
00433 virtual csRenderMesh** GetRenderMeshes (int& n) = 0;
00437 virtual void DrawShadow (iRenderView* rview, iLight *light) = 0;
00441 virtual void DrawLight (iRenderView* rview, iLight *light) = 0;
00442
00446 virtual void CastHardwareShadow (bool castShadow) = 0;
00450 virtual void SetDrawAfterShadow (bool drawAfter) = 0;
00454 virtual bool GetDrawAfterShadow () = 0;
00455 };
00456
00457 SCF_VERSION (iMeshFactoryWrapper, 0, 1, 7);
00458
00470 struct iMeshFactoryWrapper : public iBase
00471 {
00473 virtual iObject *QueryObject () = 0;
00475 virtual iMeshObjectFactory* GetMeshObjectFactory () const = 0;
00477 virtual void SetMeshObjectFactory (iMeshObjectFactory* fact) = 0;
00487 virtual void HardTransform (const csReversibleTransform& t) = 0;
00492 virtual iMeshWrapper* CreateMeshWrapper () = 0;
00493
00498 virtual iMeshFactoryWrapper* GetParentContainer () const = 0;
00503 virtual void SetParentContainer (iMeshFactoryWrapper *p) = 0;
00504
00508 virtual iMeshFactoryList* GetChildren () = 0;
00509
00513 virtual csReversibleTransform& GetTransform () = 0;
00514
00518 virtual void SetTransform (const csReversibleTransform& tr) = 0;
00519
00526 virtual iLODControl* CreateStaticLOD () = 0;
00527
00531 virtual void DestroyStaticLOD () = 0;
00532
00538 virtual iLODControl* GetStaticLOD () = 0;
00539
00547 virtual void SetStaticLOD (float m, float a) = 0;
00548
00552 virtual void GetStaticLOD (float& m, float& a) const = 0;
00553
00558 virtual void AddFactoryToStaticLOD (int lod, iMeshFactoryWrapper* fact) = 0;
00559
00564 virtual void RemoveFactoryFromStaticLOD (iMeshFactoryWrapper* fact) = 0;
00565 };
00566
00567 SCF_VERSION (iMeshList, 0, 0, 1);
00568
00572 struct iMeshList : public iBase
00573 {
00575 virtual int GetCount () const = 0;
00576
00578 virtual iMeshWrapper *Get (int n) const = 0;
00579
00581 virtual int Add (iMeshWrapper *obj) = 0;
00582
00584 virtual bool Remove (iMeshWrapper *obj) = 0;
00585
00587 virtual bool Remove (int n) = 0;
00588
00590 virtual void RemoveAll () = 0;
00591
00593 virtual int Find (iMeshWrapper *obj) const = 0;
00594
00600 virtual iMeshWrapper *FindByName (const char *Name) const = 0;
00601 };
00602
00603 SCF_VERSION (iMeshFactoryList, 0, 0, 1);
00604
00608 struct iMeshFactoryList : public iBase
00609 {
00611 virtual int GetCount () const = 0;
00612
00614 virtual iMeshFactoryWrapper *Get (int n) const = 0;
00615
00617 virtual int Add (iMeshFactoryWrapper *obj) = 0;
00618
00620 virtual bool Remove (iMeshFactoryWrapper *obj) = 0;
00621
00623 virtual bool Remove (int n) = 0;
00624
00626 virtual void RemoveAll () = 0;
00627
00629 virtual int Find (iMeshFactoryWrapper *obj) const = 0;
00630
00632 virtual iMeshFactoryWrapper *FindByName (const char *Name) const = 0;
00633 };
00634
00635 SCF_VERSION (iMeshWrapperIterator, 0, 1, 0);
00636
00640 struct iMeshWrapperIterator : public iBase
00641 {
00643 virtual iMeshWrapper* Next () = 0;
00644
00646 virtual void Reset () = 0;
00647
00649 virtual bool HasNext () const = 0;
00650 };
00651
00652
00655 #endif // __CS_IENGINE_MESH_H__
00656