#ifdef USE_D3D9
extern const DWORD D3DMeshFVF;
extern const DWORD D3DMeshOptions;
const DWORD AdjacencyBoundary = 0xffffffff;
class D3D9Mesh : public BaseMesh
{
public:
D3D9Mesh();
explicit D3D9Mesh(GraphicsDevice &_GD);
explicit D3D9Mesh(const BaseMesh &o);
explicit D3D9Mesh(const D3D9Mesh &o);
~D3D9Mesh();
void Allocate(UINT NVertices, UINT NFaces);
void CopyMesh(BaseMesh &Copy) const;
D3D9Mesh& operator = (const BaseMesh &o);
D3D9Mesh& operator = (const D3D9Mesh &o);
void FreeMemory();
UINT IndexCount() const;
UINT VertexCount() const;
UINT FaceCount() const;
MeshVertex* Vertices();
DWORD* Indices();
const MeshVertex* Vertices() const;
const DWORD* Indices() const;
LPD3DXMESH GetMesh() const; void LoadMesh(LPD3DXMESH _mesh); LPDIRECT3DDEVICE9 GetD3DDevice();
void NPatchEnhance(float segs, bool quadratic); void GenerateAdj(DWORD *& adj); void GenerateAdj(Vector<DWORD> &Adjacency);
bool QueryInside(const Vec3f &Pos, const Vec3f &Dir);
void QueryHits(const Vec3f &Pos, const Vec3f &Dir, Vector<float> &Hits, DWORD &FirstHitFaceIndex, float &u, float &v) const;
void Render() const; void Render(int Subset) const;
void CreateTeapot(float radius); void CreateText(const char *string, char *FontName, int FontHeight, float deviation, float depth, bool bold, bool italic);
void SimplifyToFaces(UINT Count); void SimplifyToPercentFaces(float NewPercent); void SimplifyToVertices(UINT Count); void SimplifyToPercentVertices(float NewPercent);
void LoadFromXFile(const String &Filename); void SaveToXFile(const String &Filename);
void Clean(float Epsilon, DWORD* &AdjDataOut);
void Optimize();
private:
void Lock() const; void LockVB() const; void LockIB() const; void Unlock() const;
LPD3DXMESH _Mesh;
mutable MeshVertex *_Vertices;
mutable DWORD *_Indices;
};
#endif