git-svn-id: svn://db.shs.com.ru/libs@421 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2018-09-07 08:37:44 +00:00
parent 38bb2244d5
commit b6bad7a921
12 changed files with 174 additions and 41 deletions

View File

@@ -42,6 +42,7 @@ class QGLView: public QGraphicsView, public QGLViewBase
#endif
{
friend class GLRendererBase;
friend class GLObjectBase;
Q_OBJECT
Q_PROPERTY (QColor backColor READ backColor WRITE setBackColor)
Q_PROPERTY (double lineWidth READ lineWidth WRITE setLineWidth)
@@ -167,9 +168,9 @@ public:
void addObject(GLObjectBase * o);
void addObject(GLObjectBase & o) {addObject(&o);}
int objectsCount(bool all = false) {if (!all) return objects_.childCount(); int cnt = 0; objectsCountInternal(&cnt, &objects_); return cnt;}
void removeObject(GLObjectBase * o, bool inChildren = true) {if (inChildren) removeObjectInternal(o, &objects_); else objects_.removeChild(o);}
void removeObject(GLObjectBase * o, bool inChildren = true);
void removeObject(GLObjectBase & o, bool inChildren = true) {removeObject(&o, inChildren);}
void clearObjects(bool deleteAll = false) {removeObject(camera_); objects_.clearChildren(deleteAll); addObject(camera()); sel_obj = hov_obj = 0;}
void clearObjects(bool deleteAll = false);
QList<GLObjectBase * > objects(bool all = false) {return objects_.children(all);}
int lightsCount() const {return lights_.size();}
@@ -200,6 +201,7 @@ public:
void setSelectionRectPen(const QPen & v) {sel_pen = v;}
void setSelectionRectBrush(const QBrush & v) {sel_brush = v;}
void selectObject(GLObjectBase * o);
GLObjectBase * selectedObject() const {return sel_obj;}
GLdouble aspect, iaspect;
QMatrix4x4 cur_mvpm;
@@ -229,9 +231,10 @@ protected:
void collectLights();
private:
void objectDeleted(GLObjectBase * o);
void collectObjectLights(GLObjectBase * o);
void objectsCountInternal(int * cnt, GLObjectBase * where) {++(*cnt); foreach (GLObjectBase * i, where->children_) objectsCountInternal(cnt, i);}
void removeObjectInternal(GLObjectBase * o, GLObjectBase * where) {foreach (GLObjectBase * i, where->children_) {if (o == i) where->removeChild(i); else removeObjectInternal(o, i);}}
void removeObjectInternal(GLObjectBase * o, GLObjectBase * where);
void renderSingleSelection(GLObjectBase & o);
//void renderSingleShadow(GLObjectBase & o);
void renderHalo(const GLObjectBase * obj, const int iid, const QColor & color, const double & fill);
@@ -306,6 +309,7 @@ public slots:
void deselect() {sel_obj = 0;}
signals:
void glBeforePaint();
void glBeginPaint();
void glPainting();
void glEndPaint();
@@ -323,6 +327,7 @@ signals:
void hoverChanged(GLObjectBase * cur, GLObjectBase * prev);
void selectionChanged(GLObjectBase * cur, GLObjectBase * prev);
void objectAdded(GLObjectBase * );
};