dxtest2

diff src/mesh.h @ 0:6ed01ded71d8

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 23 Jun 2013 04:23:13 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/mesh.h	Sun Jun 23 04:23:13 2013 +0300
     1.3 @@ -0,0 +1,37 @@
     1.4 +#ifndef MESH_H_
     1.5 +#define MESH_H_
     1.6 +
     1.7 +#include <vector>
     1.8 +#include <vmath/vmath.h>
     1.9 +#include <d3d11.h>
    1.10 +
    1.11 +struct Vertex {
    1.12 +	Vector3 pos, normal;
    1.13 +	Vector2 texcoord;
    1.14 +};
    1.15 +
    1.16 +class Mesh {
    1.17 +private:
    1.18 +	Vector3 cur_norm;
    1.19 +	Vector2 cur_texcoord;
    1.20 +
    1.21 +	std::vector<Vertex> verts;
    1.22 +	ID3D11Buffer *vbuf;
    1.23 +
    1.24 +	bool update_vbuffer();
    1.25 +	void invalidate_vbuffer();
    1.26 +
    1.27 +public:
    1.28 +	Mesh();
    1.29 +	~Mesh();
    1.30 +
    1.31 +	void clear();
    1.32 +
    1.33 +	void normal(float x, float y, float z);
    1.34 +	void texcoord(float u, float v);
    1.35 +	void vertex(float x, float y, float z);
    1.36 +
    1.37 +	void draw() const;
    1.38 +};
    1.39 +
    1.40 +#endif	// MESH_H_
    1.41 \ No newline at end of file