eqemu

diff src/mesh.h @ 3:f9274bebe55e

adding 3d graphics stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 17 Jul 2014 02:35:19 +0300
parents
children 3d3656360a82
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/mesh.h	Thu Jul 17 02:35:19 2014 +0300
     1.3 @@ -0,0 +1,33 @@
     1.4 +#ifndef MESH_H_
     1.5 +#define MESH_H_
     1.6 +
     1.7 +enum {
     1.8 +	MESH_ATTR_VERTEX,
     1.9 +	MESH_ATTR_NORMAL,
    1.10 +	MESH_ATTR_TEXCOORD,
    1.11 +
    1.12 +	NUM_MESH_ATTRIBS
    1.13 +};
    1.14 +
    1.15 +class Mesh {
    1.16 +private:
    1.17 +	float *attr[NUM_MESH_ATTRIBS];
    1.18 +	int vcount;
    1.19 +	unsigned int vbo[NUM_MESH_ATTRIBS];
    1.20 +	int attr_size[NUM_MESH_ATTRIBS];
    1.21 +
    1.22 +	mutable unsigned int buf_valid;	/* bitmask */
    1.23 +	void update_buffers() const;
    1.24 +
    1.25 +public:
    1.26 +	Mesh();
    1.27 +	~Mesh();
    1.28 +
    1.29 +	float *set_attrib(int aidx, int count, int elemsz, float *data = 0);
    1.30 +	float *get_attrib(int aidx);
    1.31 +	const float *get_attrib(int aidx) const;
    1.32 +
    1.33 +	void draw() const;
    1.34 +};
    1.35 +
    1.36 +#endif	// MESH_H_