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

This commit is contained in:
2019-12-20 10:55:11 +00:00
parent cb19854e1b
commit 7c271cc3b5
13 changed files with 193 additions and 44 deletions

View File

@@ -81,12 +81,14 @@ QGLView::QGLView(): OpenGLWindow(), renderer_(this), mouse(this) {
scene_ = new Scene();
connect(scene_, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
connect(scene_, SIGNAL(__destroyed()), this, SLOT(__destroyed()));
camera_ = new Camera();
camera_->setPos(QVector3D(2, 2, 2));
camera_->setAim(QVector3D());
connect(scene_, SIGNAL(__objectDeleted(ObjectBase*)), this, SLOT(__objectDeleted(ObjectBase*)));
default_camera = new Camera();
default_camera->setPos(QVector3D(2, 2, 2));
default_camera->setAim(QVector3D());
camera_ = default_camera;
// qDebug() << camera_->aim();
camera_->setName("Camera");
emit cameraPosChanged(camera_->pos());
default_camera->setName("Camera");
emit cameraPosChanged(default_camera->pos());
//camera().aim_ = camera().pos_;
ktm_.restart();
@@ -109,8 +111,9 @@ QGLView::QGLView(): OpenGLWindow(), renderer_(this), mouse(this) {
QGLView::~QGLView() {
deleting_ = true;
stop();
scene_->destroy();
scene_->clear();
delete scene_;
delete default_camera;
}
@@ -210,6 +213,12 @@ void QGLView::__destroyed() {
}
void QGLView::__objectDeleted(ObjectBase * o) {
if (o == camera_)
setDefaultCamera();
}
void QGLView::resizeGL(int width, int height) {
if (!is_init) return;
if (width <= 0 || height <= 0) return;