много исправлений
This commit is contained in:
24
qglview.cpp
24
qglview.cpp
@@ -30,13 +30,10 @@ using namespace QGLEngineShaders;
|
||||
|
||||
QGLView::QGLView(): OpenGLWindow(), renderer_(this), mouse(this) {
|
||||
setIcon(QIcon(":/icons/qglview.png"));
|
||||
deleting_ = false;
|
||||
is_init = false;
|
||||
timer = 0;
|
||||
need_init_ = is_first_draw = true;
|
||||
backColor_ = Qt::darkGray;
|
||||
hoverHaloColor_ = QColor(195, 140, 255);
|
||||
selectionHaloColor_ = QColor(175, 255, 140);
|
||||
ambientColor_ = QColor(10, 10, 10);
|
||||
lineWidth_ = 1.;
|
||||
max_anisotropic = 1;
|
||||
max_texture_chanels = 8;
|
||||
@@ -74,7 +71,7 @@ QGLView::QGLView(): OpenGLWindow(), renderer_(this), mouse(this) {
|
||||
setFeature(qglDepthOfFieldFocus, 1.);
|
||||
setFeature(qglDepthOfFieldDiaphragm, 8.);
|
||||
hoverHalo_ = selectionHalo_ = true;
|
||||
fogEnabled_ = is_init = shaders_bind = changed_ = false;
|
||||
fogEnabled_ = shaders_bind = false;
|
||||
rmode = ObjectBase::Fill;
|
||||
scene_ = new Scene();
|
||||
connect(scene_, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
|
||||
@@ -87,7 +84,6 @@ QGLView::QGLView(): OpenGLWindow(), renderer_(this), mouse(this) {
|
||||
// qDebug() << camera_->aim();
|
||||
default_camera->setName("Camera");
|
||||
emit cameraPosChanged(default_camera->pos());
|
||||
ktm_.restart();
|
||||
|
||||
Mesh * m = Primitive::cube(10, 10, 10);
|
||||
m->flipNormals();
|
||||
@@ -99,7 +95,6 @@ QGLView::QGLView(): OpenGLWindow(), renderer_(this), mouse(this) {
|
||||
|
||||
|
||||
QGLView::~QGLView() {
|
||||
deleting_ = true;
|
||||
stop();
|
||||
scene_->clear();
|
||||
delete scene_;
|
||||
@@ -130,9 +125,9 @@ QList<Light * > QGLView::selectedLights() const {
|
||||
QList<Camera * > QGLView::selectedCameras() const {
|
||||
QList<Camera * > ret;
|
||||
ObjectBaseList sol = scene_->selectedObjects();
|
||||
foreach (ObjectBase * o, sol)
|
||||
if (o->type() == ObjectBase::glCamera)
|
||||
ret << (Camera*)o;
|
||||
for (ObjectBase * o : sol) {
|
||||
if (o->type() == ObjectBase::glCamera) ret << (Camera*)o;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -185,7 +180,6 @@ void QGLView::initialize() {
|
||||
renderer_.init(width(), height());
|
||||
scene_->reinitAll();
|
||||
is_init = true;
|
||||
need_init_ = false;
|
||||
prev_size = QSize();
|
||||
emit glInitializeDone();
|
||||
}
|
||||
@@ -204,8 +198,7 @@ void QGLView::__destroyed() {
|
||||
|
||||
|
||||
void QGLView::__objectDeleted(ObjectBase * o) {
|
||||
if (o == camera_)
|
||||
setDefaultCamera();
|
||||
if (o == camera_) setDefaultCamera();
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +246,7 @@ void QGLView::focusOn(const Box3D & bb) {
|
||||
|
||||
QByteArray QGLView::saveCamera() {
|
||||
ChunkStream cs;
|
||||
const Camera * c = camera();
|
||||
const Camera * c = default_camera;
|
||||
cs.add(1, c->pos()).add(2, c->aim()).add(3, c->rotation()).add(4, c->FOV());
|
||||
return cs.data();
|
||||
}
|
||||
@@ -261,7 +254,8 @@ QByteArray QGLView::saveCamera() {
|
||||
|
||||
void QGLView::restoreCamera(const QByteArray & ba) {
|
||||
if (ba.isEmpty()) return;
|
||||
Camera * c = camera();
|
||||
setDefaultCamera();
|
||||
Camera * c = default_camera;
|
||||
QVector3D pos(c->pos()), aim(c->aim()), ang(c->rotation());
|
||||
float fov(c->FOV());
|
||||
ChunkStream cs(ba);
|
||||
|
||||
Reference in New Issue
Block a user