git-svn-id: svn://db.shs.com.ru/libs@665 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -30,7 +30,7 @@ Mesh::Mesh(GLenum geom_type_): geom_type(geom_type_),
|
||||
buffer_geom(GL_ARRAY_BUFFER, GL_STATIC_DRAW),
|
||||
buffer_ind (GL_ELEMENT_ARRAY_BUFFER, GL_STATIC_DRAW) {
|
||||
hash_ = 0;
|
||||
changed = hash_changed = objects_changed = selected_changed = true;
|
||||
changed = hash_changed = true;
|
||||
//qDebug() << "Mesh, now" << ++_count;
|
||||
}
|
||||
|
||||
@@ -189,14 +189,14 @@ void Mesh::draw(QOpenGLExtraFunctions * f, int count, int type) {
|
||||
|
||||
|
||||
void Mesh::clear() {
|
||||
vertices_.clear();
|
||||
normals_.clear();
|
||||
tangents_.clear();
|
||||
vertices_ .clear();
|
||||
normals_ .clear();
|
||||
tangents_ .clear();
|
||||
bitangents_.clear();
|
||||
texcoords_.clear();
|
||||
triangles_.clear();
|
||||
lines_.clear();
|
||||
data_.clear();
|
||||
texcoords_ .clear();
|
||||
triangles_ .clear();
|
||||
lines_ .clear();
|
||||
data_ .clear();
|
||||
changed = hash_changed = true;
|
||||
}
|
||||
|
||||
@@ -232,6 +232,40 @@ uint Mesh::hash() const {
|
||||
}
|
||||
|
||||
|
||||
bool Mesh::isObjectsChanged(int type) const {
|
||||
return (const_cast<Mesh*>(this))->vaoByType(type)->isObjectsChanged();
|
||||
}
|
||||
|
||||
|
||||
bool Mesh::isSelectionChanged(int type) const {
|
||||
return (const_cast<Mesh*>(this))->vaoByType(type)->isSelectionChanged();
|
||||
}
|
||||
|
||||
|
||||
void Mesh::setObjectsChanged(int type, bool yes) {
|
||||
vaoByType(type)->setObjectsChanged(yes);
|
||||
}
|
||||
|
||||
|
||||
void Mesh::setSelectionChanged(int type, bool yes) {
|
||||
vaoByType(type)->setSelectionChanged(yes);
|
||||
}
|
||||
|
||||
|
||||
void Mesh::setAllObjectsChanged(bool yes) {
|
||||
QMapIterator<int, VertexObject * > it(vao_map);
|
||||
while (it.hasNext())
|
||||
it.next().value()->setObjectsChanged(yes);
|
||||
}
|
||||
|
||||
|
||||
void Mesh::setAllSelectionChanged(bool yes) {
|
||||
QMapIterator<int, VertexObject * > it(vao_map);
|
||||
while (it.hasNext())
|
||||
it.next().value()->setSelectionChanged(yes);
|
||||
}
|
||||
|
||||
|
||||
void Mesh::translatePoints(const QVector3D & dp) {
|
||||
QMatrix4x4 m;
|
||||
m.translate(dp);
|
||||
|
||||
@@ -54,6 +54,13 @@ public:
|
||||
bool isEmpty() const {return vertices_.isEmpty();}
|
||||
uint hash() const;
|
||||
|
||||
bool isObjectsChanged (int type = 0) const;
|
||||
bool isSelectionChanged (int type = 0) const;
|
||||
void setObjectsChanged (int type = 0, bool yes = true);
|
||||
void setSelectionChanged(int type = 0, bool yes = true);
|
||||
void setAllObjectsChanged (bool yes = true);
|
||||
void setAllSelectionChanged(bool yes = true);
|
||||
|
||||
QVector<QVector3D> & vertices () {changed = hash_changed = true; return vertices_;}
|
||||
QVector<QVector3D> & normals () {changed = hash_changed = true; return normals_;}
|
||||
QVector<QVector2D> & texcoords() {changed = hash_changed = true; return texcoords_;}
|
||||
@@ -92,7 +99,7 @@ private:
|
||||
mutable uint hash_;
|
||||
mutable bool hash_changed;
|
||||
int vert_count;
|
||||
bool changed, objects_changed, selected_changed;
|
||||
bool changed;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -185,6 +185,12 @@ class RendererMaterial;
|
||||
class RendererService;
|
||||
class RendererSelection;
|
||||
|
||||
enum RenderPass {
|
||||
rpSolid,
|
||||
rpTransparent,
|
||||
};
|
||||
|
||||
typedef QList<ObjectBase*> ObjectBaseList;
|
||||
|
||||
struct Box3D {
|
||||
GLfloat x;
|
||||
|
||||
@@ -28,6 +28,7 @@ VertexObject::VertexObject():
|
||||
buffer_sel (GL_ARRAY_BUFFER, GL_STREAM_DRAW) {
|
||||
vao_ = 0;
|
||||
buffers_binded = false;
|
||||
objects_changed = selected_changed = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,12 +46,17 @@ public:
|
||||
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;
|
||||
bool buffers_binded, objects_changed, selected_changed;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user