nuclear@12: /* nuclear@12: eqemu - electronic queue system emulator nuclear@12: Copyright (C) 2014 John Tsiombikas , nuclear@12: Eleni-Maria Stea nuclear@12: nuclear@12: This program is free software: you can redistribute it and/or modify nuclear@12: it under the terms of the GNU General Public License as published by nuclear@12: the Free Software Foundation, either version 3 of the License, or nuclear@12: (at your option) any later version. nuclear@12: nuclear@12: This program is distributed in the hope that it will be useful, nuclear@12: but WITHOUT ANY WARRANTY; without even the implied warranty of nuclear@12: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nuclear@12: GNU General Public License for more details. nuclear@12: nuclear@12: You should have received a copy of the GNU General Public License nuclear@12: along with this program. If not, see . nuclear@12: */ nuclear@3: #ifndef MESH_H_ nuclear@3: #define MESH_H_ nuclear@3: nuclear@4: #include "bvol.h" nuclear@4: nuclear@3: enum { nuclear@3: MESH_ATTR_VERTEX, nuclear@3: MESH_ATTR_NORMAL, nuclear@3: MESH_ATTR_TEXCOORD, nuclear@3: nuclear@3: NUM_MESH_ATTRIBS nuclear@3: }; nuclear@3: nuclear@3: class Mesh { nuclear@3: private: nuclear@3: float *attr[NUM_MESH_ATTRIBS]; nuclear@3: int vcount; nuclear@3: unsigned int vbo[NUM_MESH_ATTRIBS]; nuclear@3: int attr_size[NUM_MESH_ATTRIBS]; nuclear@3: nuclear@3: mutable unsigned int buf_valid; /* bitmask */ nuclear@3: void update_buffers() const; nuclear@3: nuclear@4: mutable BSphere bsph; nuclear@4: mutable bool bsph_valid; nuclear@4: void calc_bsph() const; nuclear@4: nuclear@3: public: nuclear@3: Mesh(); nuclear@3: ~Mesh(); nuclear@3: nuclear@3: float *set_attrib(int aidx, int count, int elemsz, float *data = 0); nuclear@3: float *get_attrib(int aidx); nuclear@3: const float *get_attrib(int aidx) const; nuclear@3: nuclear@3: void draw() const; nuclear@4: nuclear@4: BSphere &get_bounds(); nuclear@4: const BSphere &get_bounds() const; nuclear@3: }; nuclear@3: nuclear@3: #endif // MESH_H_