00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __NEMESH_H
00028 #define __NEMESH_H
00029
00030
00037 #include "base.h"
00038 #include "pointer.h"
00039 #include "sceneentity.h"
00040 #include "pool.h"
00041
00042 #include <vector>
00043 #include <string>
00044
00045
00046 namespace NeoEngine
00047 {
00048
00049
00050
00051 class SubMesh;
00052 class Skeleton;
00053
00054
00055
00056 class Mesh;
00057 class MeshEntity;
00058
00059 #ifdef WIN32
00060 # ifndef __HAVE_VECTOR_NESUBMESH
00061 UDTVectorEXPIMP( class SubMesh* );
00062 # define __HAVE_VECTOR_NESUBMESH
00063 # endif
00064 #endif
00065
00066
00067 PoolExport( Mesh );
00068
00069 typedef Pool< Mesh > MeshPool;
00070
00071
00076 class NEOENGINE_API Mesh : public RefCounter
00077 {
00078 protected:
00079
00081 MeshPool *m_pkPool;
00082
00084 HashString m_strName;
00085
00086
00087 public:
00088
00090 std::vector< SubMesh* > m_vpkSubMeshes;
00091
00093 Skeleton *m_pkSkeleton;
00094
00095
00100 Mesh( const HashString &rstrName = "", MeshPool *pkPool = 0 );
00101
00104 virtual ~Mesh();
00105
00109 inline const HashString &GetName() const { return m_strName; }
00110
00115 void SetName( const HashString &rstrName );
00116 };
00117
00118
00119 SmartPointer( Mesh );
00120
00121
00127 class NEOENGINE_API MeshEntity : public SceneEntity
00128 {
00129 public:
00130
00131 DefineVisitable()
00132
00133
00134 public:
00135
00139 enum MESHFLAG
00140 {
00141 NOFLAGS = 0x00000000,
00142
00144 VOLUMEINTERSECTION = 0x00000001,
00145
00147 AUTOGENVOLUME = 0x00000002
00148 };
00149
00150
00151 protected:
00152
00154 MeshPtr m_pkMesh;
00155
00157 Skeleton *m_pkSkeleton;
00158
00160 std::vector< SubMesh* > m_vpkSubMeshes;
00161
00163 unsigned int m_uiFlags;
00164
00165
00169 virtual void SetNode();
00170
00171
00172 public:
00173
00177 MeshEntity( const MeshPtr &pkMesh );
00178
00182 MeshEntity( MeshEntity &rkMesh );
00183
00186 virtual ~MeshEntity();
00187
00194 virtual bool Render( Frustum *pkFrustum = 0, bool bForce = false );
00195
00200 virtual void Update( float fDeltaTime );
00201
00206 virtual SceneEntity *Duplicate();
00207
00215 virtual bool Intersection( BoundingVolume *pkObj, ContactSet *pkContactSet = 0, bool bInvertNormal = false );
00216
00223 virtual bool Intersection( const Ray &rkRay, ContactSet *pkContactSet = 0 );
00224
00229 void SetSubMeshAnimation( const HashString &rstrAnimation );
00230
00235 void SetSubMeshAnimation( unsigned int uiAnimation );
00236
00241 virtual void SetFlags( unsigned int uiFlags );
00242
00247 virtual void ResetFlags( unsigned int uiFlags );
00248
00252 inline const std::vector< SubMesh* > &GetSubMeshes() const { return m_vpkSubMeshes; }
00253
00257 inline Skeleton *GetSkeleton() { return m_pkSkeleton; }
00258
00262 inline MeshPtr GetMesh() { return m_pkMesh; }
00263
00267 void GenerateBoundingVolume();
00268 };
00269
00270
00271 };
00272
00273
00274 #endif