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 __NESUBMESH_H
00028 #define __NESUBMESH_H
00029
00030
00037 #include "base.h"
00038 #include "material.h"
00039 #include "vertexbuffer.h"
00040 #include "polygonbuffer.h"
00041 #include "updateentity.h"
00042
00043
00044 namespace NeoEngine
00045 {
00046
00047
00048
00049 class Frustum;
00050 class RenderPrimitive;
00051
00052
00059 class NEOENGINE_API SubMesh : public virtual UpdateEntity
00060 {
00061 public:
00062
00066 enum SUBMESHTYPE
00067 {
00069 SUBMESH = 0x0001,
00070
00072 ANIMATEDSUBMESH = 0x0002,
00073
00075 SKELETALSUBMESH = 0x0003,
00076
00078 PATCHSURFACE = 0x0004
00079 };
00080
00081
00082 protected:
00083
00085 VertexBufferPtr m_pkVertices;
00086
00088 PolygonBufferPtr m_pkPolygons;
00089
00091 bool m_bNeedUpdate;
00092
00094 VertexBufferPtr m_pkShadowVertices;
00095
00097 PolygonBufferPtr m_pkShadowPolygons;
00098
00102 virtual void UpdateData();
00103
00104
00105
00106 public:
00107
00109 MaterialPtr m_pkMaterial;
00110
00112 bool m_bChanged;
00113
00114
00117 SubMesh();
00118
00122 SubMesh( const SubMesh &rkSubMesh );
00123
00126 virtual ~SubMesh();
00127
00132 virtual void Update( float fDeltaTime );
00133
00137 virtual VertexBufferPtr &GetVertexBuffer() { if( m_bNeedUpdate ) UpdateData(); return m_pkVertices; }
00138
00142 virtual PolygonBufferPtr &GetPolygonBuffer() { if( m_bNeedUpdate ) UpdateData(); return m_pkPolygons; }
00143
00147 virtual void SetVertexBuffer( VertexBufferPtr pkVertices );
00148
00152 virtual void SetPolygonBuffer( PolygonBufferPtr pkPolygons );
00153
00157 virtual void SetShadowVertexBuffer( VertexBufferPtr pkVertices );
00158
00162 virtual void SetShadowPolygonBuffer( PolygonBufferPtr pkPolygons );
00163
00167 virtual SubMesh *Duplicate() const;
00168
00172 virtual unsigned int GetType() const { return SUBMESH; }
00173
00179 virtual void Render( RenderPrimitive *pkPrimitive, Frustum *pkFrustum = 0 );
00180 };
00181
00182
00183 };
00184
00185
00186 #endif
00187