initial commit
This commit is contained in:
64
core/glvertexobject.h
Normal file
64
core/glvertexobject.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
QGL VertexObject
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GLVERTEXOBJECT_H
|
||||
#define GLVERTEXOBJECT_H
|
||||
|
||||
#include "glbuffer.h"
|
||||
#include "glshaders_types.h"
|
||||
|
||||
|
||||
class VertexObject
|
||||
{
|
||||
friend class Mesh;
|
||||
public:
|
||||
VertexObject();
|
||||
~VertexObject();
|
||||
|
||||
void init (QOpenGLExtraFunctions * f);
|
||||
void destroy (QOpenGLExtraFunctions * f);
|
||||
|
||||
void bind (QOpenGLExtraFunctions * f);
|
||||
void release (QOpenGLExtraFunctions * f);
|
||||
|
||||
void bindBuffers (QOpenGLExtraFunctions * f, Buffer & geom, Buffer & elem, bool force = false);
|
||||
void loadObject (QOpenGLExtraFunctions * f, const QGLEngineShaders::Object & object);
|
||||
void loadObjects (QOpenGLExtraFunctions * f, const QVector<QGLEngineShaders::Object> & objects);
|
||||
void loadSelections(QOpenGLExtraFunctions * f, const QVector<uchar> & sels);
|
||||
|
||||
void draw(QOpenGLExtraFunctions * f, GLenum geom_type, int vert_cout, int obj_count);
|
||||
|
||||
GLuint ID() const {return vao_;}
|
||||
bool isInit() const {return vao_ != 0;}
|
||||
|
||||
bool isObjectsChanged() const {return objects_changed;}
|
||||
bool isSelectionChanged() const {return selected_changed;}
|
||||
void setObjectsChanged(bool yes = true) {objects_changed = yes;}
|
||||
void setSelectionChanged(bool yes = true) {selected_changed = yes;}
|
||||
|
||||
private:
|
||||
void loadBuffer(QOpenGLExtraFunctions * f, Buffer & buf, const void * data, int size);
|
||||
|
||||
GLuint vao_;
|
||||
Buffer buffer_obj, buffer_sel;
|
||||
bool buffers_binded, objects_changed, selected_changed;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // GLVERTEXOBJECT_H
|
||||
Reference in New Issue
Block a user