git-svn-id: svn://db.shs.com.ru/libs@578 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -175,3 +175,46 @@ void GLPrimitiveEllipsoid::init() {
|
|||||||
is_init = true;
|
is_init = true;
|
||||||
vbo.rebuffer();
|
vbo.rebuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GLPrimitiveAxis::draw(QOpenGLShaderProgram * prog, bool simplest) {
|
||||||
|
float bs = 1.f;
|
||||||
|
float as = 0.1f;
|
||||||
|
float aw = 0.07f;
|
||||||
|
float cr_x = 0.8f, cg_y = 0.75f, cb_z = 0.8f;
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glColor3f(cr_x, 0, 0);
|
||||||
|
glVertex3f(-bs, 0, 0);
|
||||||
|
glVertex3f(bs, 0, 0);
|
||||||
|
glVertex3f(bs, 0, 0);
|
||||||
|
glVertex3f(bs-as, aw, 0);
|
||||||
|
glVertex3f(bs, 0, 0);
|
||||||
|
glVertex3f(bs-as, -aw, 0);
|
||||||
|
glVertex3f(bs, 0, 0);
|
||||||
|
glVertex3f(bs-as, 0, aw);
|
||||||
|
glVertex3f(bs, 0, 0);
|
||||||
|
glVertex3f(bs-as, 0, -aw);
|
||||||
|
glColor3f(0, cg_y, 0);
|
||||||
|
glVertex3f(0, -bs, 0);
|
||||||
|
glVertex3f(0, bs, 0);
|
||||||
|
glVertex3f(0, bs, 0);
|
||||||
|
glVertex3f(0, bs-as, aw);
|
||||||
|
glVertex3f(0, bs, 0);
|
||||||
|
glVertex3f(0, bs-as, -aw);
|
||||||
|
glVertex3f(0, bs, 0);
|
||||||
|
glVertex3f(aw, bs-as, 0);
|
||||||
|
glVertex3f(0, bs, 0);
|
||||||
|
glVertex3f(-aw, bs-as, 0);
|
||||||
|
glColor3f(0, 0, cb_z);
|
||||||
|
glVertex3f(0, 0, -bs);
|
||||||
|
glVertex3f(0, 0, bs);
|
||||||
|
glVertex3f(0, 0, bs);
|
||||||
|
glVertex3f(aw, 0, bs-as);
|
||||||
|
glVertex3f(0, 0, bs);
|
||||||
|
glVertex3f(-aw, 0, bs-as);
|
||||||
|
glVertex3f(0, 0, bs);
|
||||||
|
glVertex3f(0, aw, bs-as);
|
||||||
|
glVertex3f(0, 0, bs);
|
||||||
|
glVertex3f(0, -aw, bs-as);
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
|||||||
@@ -74,4 +74,12 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class GLPrimitiveAxis: public GLObjectBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GLPrimitiveAxis() {accept_fog = accept_light = cast_shadow = rec_shadow = select_ = false;}
|
||||||
|
virtual void draw(QOpenGLShaderProgram * prog, bool simplest = false);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // GLPRIMITIVE_CUBE_H
|
#endif // GLPRIMITIVE_CUBE_H
|
||||||
|
|||||||
@@ -104,6 +104,11 @@ qreal GLWidget::selectionHaloFillAlpha() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GLWidget::addObject(GLObjectBase * o) {
|
||||||
|
view_->addObject(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLWidget::stop() {
|
void GLWidget::stop() {
|
||||||
view_->stop();
|
view_->stop();
|
||||||
}
|
}
|
||||||
@@ -113,7 +118,7 @@ void GLWidget::start(float freq, GLRendererBase * r) {
|
|||||||
if (r == nullptr) r = new RendererSimple(view_);
|
if (r == nullptr) r = new RendererSimple(view_);
|
||||||
GLRendererBase * pr = nullptr;
|
GLRendererBase * pr = nullptr;
|
||||||
view_->setRenderer(r, &pr);
|
view_->setRenderer(r, &pr);
|
||||||
if (pr != nullptr) delete pr;
|
if (pr != nullptr && pr != r) delete pr;
|
||||||
view_->start(freq);
|
view_->start(freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
class QGLView;
|
class QGLView;
|
||||||
class GLRendererBase;
|
class GLRendererBase;
|
||||||
|
class GLObjectBase;
|
||||||
|
|
||||||
class GLWidget : public QWidget
|
class GLWidget : public QWidget
|
||||||
{
|
{
|
||||||
@@ -48,6 +49,8 @@ public:
|
|||||||
QColor selectionHaloColor() const;
|
QColor selectionHaloColor() const;
|
||||||
qreal selectionHaloFillAlpha() const;
|
qreal selectionHaloFillAlpha() const;
|
||||||
|
|
||||||
|
void addObject(GLObjectBase * o);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void stop();
|
void stop();
|
||||||
void start(float freq = 60.0, GLRendererBase * r = nullptr);
|
void start(float freq = 60.0, GLRendererBase * r = nullptr);
|
||||||
|
|||||||
Reference in New Issue
Block a user