много исправлений
This commit is contained in:
@@ -75,6 +75,7 @@ void Scene::addScene(const Scene * s) {
|
||||
|
||||
void Scene::assignFrom(const Scene * s) {
|
||||
clear();
|
||||
if (!s) return;
|
||||
setName(s->name());
|
||||
foreach (Material * m, s->materials) {
|
||||
Material * nm = new Material();
|
||||
|
||||
20
glwidget.cpp
20
glwidget.cpp
@@ -35,11 +35,6 @@ GLWidget::GLWidget(QWidget *parent) : QWidget(parent) {
|
||||
}
|
||||
|
||||
|
||||
QColor GLWidget::backColor() const {
|
||||
return view_->backColor();
|
||||
}
|
||||
|
||||
|
||||
qreal GLWidget::lineWidth() const {
|
||||
return view_->lineWidth();
|
||||
}
|
||||
@@ -55,11 +50,6 @@ qreal GLWidget::depthStart() const {
|
||||
}
|
||||
|
||||
|
||||
QColor GLWidget::ambientColor() const {
|
||||
return view_->ambientColor();
|
||||
}
|
||||
|
||||
|
||||
bool GLWidget::isLightEnabled() const {
|
||||
return view_->isLightEnabled();
|
||||
}
|
||||
@@ -146,11 +136,6 @@ void GLWidget::start(float freq) {
|
||||
}
|
||||
|
||||
|
||||
void GLWidget::setBackColor(const QColor & c) {
|
||||
view_->setBackColor(c);
|
||||
}
|
||||
|
||||
|
||||
void GLWidget::setLineWidth(const qreal & arg) {
|
||||
view_->setLineWidth(arg);
|
||||
}
|
||||
@@ -166,11 +151,6 @@ void GLWidget::setDepthStart(const qreal & arg) {
|
||||
}
|
||||
|
||||
|
||||
void GLWidget::setAmbientColor(const QColor & arg) {
|
||||
view_->setAmbientColor(arg);
|
||||
}
|
||||
|
||||
|
||||
void GLWidget::setLightEnabled(const bool & arg) {
|
||||
view_->setLightEnabled(arg);
|
||||
}
|
||||
|
||||
@@ -29,11 +29,9 @@ class Scene;
|
||||
class GLWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY (QColor backColor READ backColor WRITE setBackColor)
|
||||
Q_PROPERTY (qreal lineWidth READ lineWidth WRITE setLineWidth)
|
||||
Q_PROPERTY (qreal FOV READ FOV WRITE setFOV)
|
||||
Q_PROPERTY (qreal depthStart READ depthStart WRITE setDepthStart)
|
||||
Q_PROPERTY (QColor ambientColor READ ambientColor WRITE setAmbientColor)
|
||||
Q_PROPERTY (bool grabMouse READ isGrabMouseEnabled WRITE setGrabMouseEnabled)
|
||||
Q_PROPERTY (bool mouseRotate READ isMouseRotateEnabled WRITE setMouseRotateEnabled)
|
||||
Q_PROPERTY (bool mouseSelection READ isMouseSelectionEnabled WRITE setMouseSelectionEnabled)
|
||||
@@ -73,11 +71,9 @@ public:
|
||||
public slots:
|
||||
void stop();
|
||||
void start(float freq = 0.0);
|
||||
void setBackColor(const QColor & c);
|
||||
void setLineWidth(const qreal & arg);
|
||||
void setFOV(const qreal & arg);
|
||||
void setDepthStart(const qreal & arg);
|
||||
void setAmbientColor(const QColor & arg);
|
||||
void setLightEnabled(const bool & arg);
|
||||
void setGrabMouseEnabled(const bool & arg);
|
||||
void setMouseRotateEnabled(const bool & arg);
|
||||
|
||||
@@ -68,19 +68,19 @@ bool OpenGLWindow::getVSync() const {
|
||||
}
|
||||
|
||||
|
||||
void OpenGLWindow::setSamples(int samples) {
|
||||
QSurfaceFormat f = requestedFormat();
|
||||
if (f.samples() != samples) {
|
||||
f.setSamples(samples);
|
||||
setFormat(f);
|
||||
format_change = true;
|
||||
}
|
||||
}
|
||||
//void OpenGLWindow::setSamples(int samples) {
|
||||
// QSurfaceFormat f = requestedFormat();
|
||||
// if (f.samples() != samples) {
|
||||
// f.setSamples(samples);
|
||||
// setFormat(f);
|
||||
// format_change = true;
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
int OpenGLWindow::getSamples() const {
|
||||
return requestedFormat().samples();
|
||||
}
|
||||
//int OpenGLWindow::getSamples() const {
|
||||
// return requestedFormat().samples();
|
||||
//}
|
||||
|
||||
|
||||
void OpenGLWindow::renderNow() {
|
||||
|
||||
@@ -18,8 +18,8 @@ public:
|
||||
QOpenGLContext * context() {return m_context;}
|
||||
void setVSync(bool on);
|
||||
bool getVSync() const;
|
||||
void setSamples(int samples);
|
||||
int getSamples() const;
|
||||
// void setSamples(int samples);
|
||||
// int getSamples() const;
|
||||
int getFrameCounter() const {return frame_cnt;}
|
||||
|
||||
public slots:
|
||||
|
||||
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);
|
||||
|
||||
20
qglview.h
20
qglview.h
@@ -34,13 +34,11 @@ class QGLView: public OpenGLWindow
|
||||
{
|
||||
friend class RendererSelection;
|
||||
Q_OBJECT
|
||||
Q_PROPERTY (QColor backColor READ backColor WRITE setBackColor)
|
||||
Q_PROPERTY (float lineWidth READ lineWidth WRITE setLineWidth)
|
||||
Q_PROPERTY (float FOV READ FOV WRITE setFOV)
|
||||
Q_PROPERTY (float depthStart READ depthStart WRITE setDepthStart)
|
||||
Q_PROPERTY (float gamma READ gamma WRITE setGamma)
|
||||
Q_PROPERTY (bool autoExposure READ autoExposure WRITE setAutoExposure)
|
||||
Q_PROPERTY (QColor ambientColor READ ambientColor WRITE setAmbientColor)
|
||||
Q_PROPERTY (QColor fogColor READ fogColor WRITE setFogColor)
|
||||
Q_PROPERTY (bool fogEnabled READ isFogEnabled WRITE setFogEnabled)
|
||||
Q_PROPERTY (float fogDensity READ fogDensity WRITE setFogDensity)
|
||||
@@ -102,7 +100,6 @@ public:
|
||||
void stop();
|
||||
void start(float freq = 0.);
|
||||
|
||||
QColor backColor() const {return backColor_;}
|
||||
float lineWidth() const {return lineWidth_;}
|
||||
float FOV() const {return camera()->FOV();}
|
||||
float depthStart() const {return camera()->depthStart();}
|
||||
@@ -112,7 +109,6 @@ public:
|
||||
int maxAnisotropicLevel() const {return max_anisotropic;}
|
||||
QString environmentMapFile() const {return renderer_.tex_env.fileHDR();}
|
||||
|
||||
QColor ambientColor() const {return ambientColor_;}
|
||||
QColor fogColor() const {return fogColor_;}
|
||||
float fogDensity() const {return fogDensity_;}
|
||||
float fogDecay() const {return fogDecay_;}
|
||||
@@ -167,6 +163,7 @@ public:
|
||||
const Camera * camera() const {return camera_;}
|
||||
void setCamera(Camera * camera) {camera_ = camera;}
|
||||
void setDefaultCamera() {camera_ = default_camera;}
|
||||
bool isDefaultCamera() const {return camera_ == default_camera;}
|
||||
QByteArray saveCamera();
|
||||
void restoreCamera(const QByteArray & ba);
|
||||
QByteArray saveFeatures();
|
||||
@@ -209,8 +206,8 @@ private:
|
||||
MouseController mouse;
|
||||
QMenu context_menu;
|
||||
QSet<int> keys_;
|
||||
QColor backColor_, fogColor_, ambientColor_, hoverHaloColor_, selectionHaloColor_;
|
||||
QElapsedTimer time, ktm_;
|
||||
QColor fogColor_, hoverHaloColor_, selectionHaloColor_;
|
||||
QElapsedTimer time;
|
||||
GLint max_anisotropic, max_texture_chanels;
|
||||
ObjectBase::RenderMode rmode;
|
||||
QHash<int, QVariant> features_;
|
||||
@@ -218,23 +215,22 @@ private:
|
||||
float lineWidth_;
|
||||
float fps_, fps_tm, fogDensity_, fogDecay_;
|
||||
float hoverHaloFill_, selectionHaloFill_, m_motionBlurFactor;
|
||||
int timer, fps_cnt, sh_id_loc, deleting_;
|
||||
bool is_first_draw, is_init, fogEnabled_, lightEnabled_;
|
||||
bool shaders_supported, changed_, need_init_;
|
||||
bool hoverHalo_, selectionHalo_, shaders_bind;
|
||||
int timer, fps_cnt, sh_id_loc;
|
||||
bool fogEnabled_, lightEnabled_;
|
||||
bool shaders_supported, shaders_bind;
|
||||
bool hoverHalo_, selectionHalo_;
|
||||
bool is_init;
|
||||
|
||||
private slots:
|
||||
void __destroyed();
|
||||
void __objectDeleted(ObjectBase * o);
|
||||
|
||||
public slots:
|
||||
void setBackColor(const QColor & arg) {backColor_ = arg;}
|
||||
void setLineWidth(const float & arg) {lineWidth_ = arg;}
|
||||
void setFOV(const float & arg) {camera()->setFOV(arg);}
|
||||
void setDepthStart(const float & arg) {camera()->setDepthStart(arg);}
|
||||
void setGamma(const float & arg) {renderer_.gamma_ = arg;}
|
||||
void setAutoExposure(bool arg) {renderer_.tone_proc.enabled = arg;}
|
||||
void setAmbientColor(const QColor & arg) {ambientColor_ = arg;}
|
||||
void setEnvironmentMapFile(QString file) {renderer_.tex_env.setFileHDR(file); renderer_.recreateMaterialThumbnails(true);}
|
||||
void setFogColor(const QColor & arg) {fogColor_ = arg;}
|
||||
void setFogDensity(const float & arg) {fogDensity_ = arg;}
|
||||
|
||||
@@ -42,7 +42,6 @@ QGLViewWindow::QGLViewWindow(QWidget * parent): QMainWindow(parent), Ui::QGLView
|
||||
view->view()->setMouseSelectionEnabled(true);
|
||||
view->view()->setSelectionHaloEnabled(true);
|
||||
view->view()->setHoverHaloEnabled(true);
|
||||
view->view()->setBackColor(Qt::lightGray);
|
||||
view->view()->setDepthStart(0.1);
|
||||
view->view()->setSelectionMode(Scene::smMultiSelection);
|
||||
|
||||
|
||||
@@ -291,8 +291,9 @@ void Renderer::renderScene() {
|
||||
/// lights
|
||||
cur_lights = scene.lights_used;
|
||||
bool use_camlight = (camera_light_mode == QGLView::clmOn);
|
||||
if ((camera_light_mode == QGLView::clmAuto) && cur_lights.isEmpty())
|
||||
if ((camera_light_mode == QGLView::clmAuto) && cur_lights.isEmpty()) {
|
||||
use_camlight = true;
|
||||
}
|
||||
if (use_camlight) {
|
||||
cur_lights[Light::Omni] << cam_light;
|
||||
cam_light->setPos(cam->pos());
|
||||
@@ -346,16 +347,16 @@ void Renderer::renderScene() {
|
||||
}
|
||||
|
||||
/// tonemapping
|
||||
if (tone_proc.process())
|
||||
fbo_out.bind();
|
||||
if (tone_proc.process()) fbo_out.bind();
|
||||
if (bindShader(srTonemapPass, &prog)) {
|
||||
prog->setUniformValue("gamma", gamma_);
|
||||
prog->setUniformValue("frame_max", tone_proc.frameMax());
|
||||
fbo_out.bindColorTexture(obrSum, 0);
|
||||
fbo_out.setWriteBuffer(obrTonemap);
|
||||
renderQuad(prog, quad);
|
||||
} else
|
||||
} else {
|
||||
fbo_out.blit(obrSum, fbo_out.id(), obrTonemap, fbo_out.rect(), fbo_out.rect());
|
||||
}
|
||||
//glClearFramebuffer(Qt::red, false);
|
||||
fbo_out.release();
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ void RendererMaterial::renderMaterial(Material * m) {
|
||||
mat_l[Light::Omni] << mat_light;
|
||||
r->reloadLightsParameters(mat_l);
|
||||
r->reloadLightsPositions(mat_camera);
|
||||
glClearFramebuffer(r->view->backColor(), false);
|
||||
glClearFramebuffer(Qt::black, false);
|
||||
r->renderQuad(prog, r->quad, mat_camera);
|
||||
r->view->scene()->setLightsChanged();
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ SceneTree::SceneTree(QWidget * parent): QWidget(parent) {
|
||||
ui->treeObjects->header()->setSectionResizeMode(cVis, QHeaderView::ResizeToContents);
|
||||
ui->treeObjects->header()->setSectionsMovable(false);
|
||||
ui->treeObjects->header()->swapSections(cName, cVis);
|
||||
ui->treeObjects->setItemDelegateForColumn(1, new NoEditDelegate(this));
|
||||
ui->treeObjects->setItemDelegateForColumn(2, new NoEditDelegate(this));
|
||||
icon_empty = QIcon(":/icons/type-empty.png");
|
||||
icon_geo = QIcon(":/icons/type-geo.png");
|
||||
icon_camera = QIcon(":/icons/type-camera.png");
|
||||
@@ -110,6 +112,11 @@ QList<QAction *> SceneTree::actionsSelection() {
|
||||
}
|
||||
|
||||
|
||||
void SceneTree::expandItems() {
|
||||
ui->treeObjects->expandAll();
|
||||
}
|
||||
|
||||
|
||||
void SceneTree::changeEvent(QEvent * e) {
|
||||
QWidget::changeEvent(e);
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
@@ -265,19 +272,30 @@ bool SceneTree::filterTree(QTreeWidgetItem * ti, const QString & filter, int typ
|
||||
|
||||
void SceneTree::checkActions() {
|
||||
bool has_1 = false, has_m = false;
|
||||
bool has_cam = false;
|
||||
bool has_mesh = false;
|
||||
bool is_def_cam = false;
|
||||
if (view) {
|
||||
has_1 = !view->selectedObjects().isEmpty();
|
||||
has_m = view->selectedObjects().size() > 1;
|
||||
is_def_cam = view->isDefaultCamera();
|
||||
ObjectBaseList slo = view->selectedObjects();
|
||||
has_1 = !slo.isEmpty();
|
||||
has_m = slo.size() > 1;
|
||||
for (ObjectBase * o : slo) {
|
||||
if (o->type() == ObjectBase::glCamera) has_cam = (slo.size() == 1);
|
||||
if (o->type() == ObjectBase::glMesh) has_mesh = true;
|
||||
}
|
||||
}
|
||||
ui->actionFocus ->setEnabled(has_1);
|
||||
|
||||
ui->actionFocus ->setEnabled(has_mesh);
|
||||
ui->actionRemove->setEnabled(has_1);
|
||||
ui->actionClone ->setEnabled(has_1);
|
||||
ui->actionGroup->setEnabled(has_m);
|
||||
ui->actionTransfer_transform_to_children->setEnabled(has_1);
|
||||
ui->actionSelect_parent->setEnabled(has_1);
|
||||
ui->actionSelect_by_mesh->setEnabled(has_1);
|
||||
ui->actionSelect_by_material->setEnabled(has_1);
|
||||
ui->actionActive_camera->setEnabled(has_1);
|
||||
ui->actionSelect_by_mesh->setEnabled(has_mesh);
|
||||
ui->actionSelect_by_material->setEnabled(has_mesh);
|
||||
ui->actionActive_camera->setEnabled(has_cam);
|
||||
ui->actionDefault_camera->setEnabled(is_def_cam);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
void assignQGLView(QGLView * v);
|
||||
QList<QAction*> actionsAdd();
|
||||
QList<QAction*> actionsSelection();
|
||||
void expandItems();
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent * e);
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonFilter">
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/widgets/qad_widgets.qrc">
|
||||
<iconset resource="../../qad/libs/application/qad_application.qrc">
|
||||
<normaloff>:/icons/configure.png</normaloff>:/icons/configure.png</iconset>
|
||||
</property>
|
||||
<property name="popupMode">
|
||||
@@ -98,6 +98,9 @@
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="autoExpandDelay">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="uniformRowHeights">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -124,7 +127,7 @@
|
||||
</layout>
|
||||
<action name="actionFocus">
|
||||
<property name="icon">
|
||||
<iconset resource="../qglview.qrc">
|
||||
<iconset resource="../../qad/libs/qglview/qglview.qrc">
|
||||
<normaloff>:/icons/type-camera.png</normaloff>:/icons/type-camera.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -133,7 +136,7 @@
|
||||
</action>
|
||||
<action name="actionRemove">
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/utils/qad_utils.qrc">
|
||||
<iconset resource="../../qad/libs/blockview/qad_blockview.qrc">
|
||||
<normaloff>:/icons/edit-delete.png</normaloff>:/icons/edit-delete.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -142,7 +145,7 @@
|
||||
</action>
|
||||
<action name="actionClone">
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/utils/qad_utils.qrc">
|
||||
<iconset resource="../../qad/libs/application/qad_application.qrc">
|
||||
<normaloff>:/icons/edit-copy.png</normaloff>:/icons/edit-copy.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -169,7 +172,7 @@
|
||||
</action>
|
||||
<action name="actionSelect_by_mesh">
|
||||
<property name="icon">
|
||||
<iconset resource="../qglview.qrc">
|
||||
<iconset resource="../../qad/libs/qglview/qglview.qrc">
|
||||
<normaloff>:/icons/type-geo.png</normaloff>:/icons/type-geo.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -178,7 +181,7 @@
|
||||
</action>
|
||||
<action name="actionSelect_by_material">
|
||||
<property name="icon">
|
||||
<iconset resource="../../qad/blockview/qad_blockview.qrc">
|
||||
<iconset resource="../../qad/libs/blockview/qad_blockview.qrc">
|
||||
<normaloff>:/icons/format-fill-color.png</normaloff>:/icons/format-fill-color.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -229,7 +232,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qglview.qrc">
|
||||
<iconset resource="../../qad/libs/qglview/qglview.qrc">
|
||||
<normaloff>:/icons/type-geo.png</normaloff>:/icons/type-geo.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -241,7 +244,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qglview.qrc">
|
||||
<iconset resource="../../qad/libs/qglview/qglview.qrc">
|
||||
<normaloff>:/icons/type-light.png</normaloff>:/icons/type-light.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -253,7 +256,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../qglview.qrc">
|
||||
<iconset resource="../../qad/libs/qglview/qglview.qrc">
|
||||
<normaloff>:/icons/type-camera.png</normaloff>:/icons/type-camera.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -267,7 +270,7 @@
|
||||
</action>
|
||||
<action name="actionActive_camera">
|
||||
<property name="icon">
|
||||
<iconset resource="../qglview.qrc">
|
||||
<iconset resource="../../qad/libs/qglview/qglview.qrc">
|
||||
<normaloff>:/icons/type-camera.png</normaloff>:/icons/type-camera.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -276,7 +279,7 @@
|
||||
</action>
|
||||
<action name="actionDefault_camera">
|
||||
<property name="icon">
|
||||
<iconset resource="../qglview.qrc">
|
||||
<iconset resource="../../qad/libs/qglview/qglview.qrc">
|
||||
<normaloff>:/icons/type-camera.png</normaloff>:/icons/type-camera.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
@@ -297,11 +300,16 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../qad/utils/qad_utils.qrc"/>
|
||||
<include location="../../qad/widgets/qad_widgets.qrc"/>
|
||||
<include location="../../qad/blockview/qad_blockview.qrc"/>
|
||||
<include location="../../qad/libs/application/qad_application.qrc"/>
|
||||
<include location="../../qad/libs/blockview/qad_blockview.qrc"/>
|
||||
<include location="../../qad/libs/qglview/qglview.qrc"/>
|
||||
<include location="widgets.qrc"/>
|
||||
<include location="../qglview.qrc"/>
|
||||
<include location="../../qad/libs/application/qad_application.qrc"/>
|
||||
<include location="../../qad/libs/blockview/qad_blockview.qrc"/>
|
||||
<include location="../../qad/libs/qglview/qglview.qrc"/>
|
||||
<include location="../qglview.qrc"/>
|
||||
<include location="widgets.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <QDropEvent>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
class InternalMoveTreeWidget: public QTreeWidget
|
||||
{
|
||||
@@ -48,4 +49,13 @@ signals:
|
||||
|
||||
};
|
||||
|
||||
|
||||
class NoEditDelegate: public QStyledItemDelegate {
|
||||
public:
|
||||
NoEditDelegate(QObject* parent=0): QStyledItemDelegate(parent) {}
|
||||
virtual QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // TREEWIDGET_H
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
ViewEditor::ViewEditor(QWidget * parent): QWidget(parent) {
|
||||
ui = new Ui::ViewEditor();
|
||||
ui->setupUi(this);
|
||||
view = 0;
|
||||
view = nullptr;
|
||||
active = true;
|
||||
ui->checkCameraLight->setCheckState(Qt::PartiallyChecked);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,12,0)
|
||||
@@ -54,7 +54,9 @@ void ViewEditor::assignQGLView(QGLView * v) {
|
||||
ui->lineHDR->setProperty("GLpath", view->environmentMapFile());
|
||||
ui->lineHDR->setText(QFileInfo(view->environmentMapFile()).fileName());
|
||||
ui->checkVSync->setChecked(view->getVSync());
|
||||
ui->spinSamples->setValue(view->getSamples());
|
||||
ui->colorFogBack->setColor(view->fogColor());
|
||||
ui->spinFogDecay->setValue(view->fogDecay());
|
||||
ui->spinFogDensity->setValue(view->fogDensity());
|
||||
active = true;
|
||||
}
|
||||
|
||||
@@ -181,12 +183,26 @@ void ViewEditor::on_buttonHDRSelect_clicked() {
|
||||
}
|
||||
|
||||
|
||||
void ViewEditor::on_colorFogBack_colorChanged(const QColor & color) {
|
||||
if (!view || !active) return;
|
||||
view->setFogColor(color);
|
||||
}
|
||||
|
||||
|
||||
void ViewEditor::on_spinFogDensity_valueChanged(double arg1) {
|
||||
if (!view || !active) return;
|
||||
view->setFogDensity(arg1);
|
||||
}
|
||||
|
||||
|
||||
void ViewEditor::on_spinFogDecay_valueChanged(double arg1) {
|
||||
if (!view || !active) return;
|
||||
view->setFogDecay(arg1);
|
||||
}
|
||||
|
||||
|
||||
void ViewEditor::on_checkVSync_clicked(bool val) {
|
||||
if (!view || !active) return;
|
||||
view->setVSync(val);
|
||||
}
|
||||
|
||||
|
||||
void ViewEditor::on_spinSamples_valueChanged(int arg1) {
|
||||
view->setSamples(arg1);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,9 +58,11 @@ private slots:
|
||||
void on_checkService_clicked(bool val);
|
||||
void on_checkCameraLight_stateChanged(int s);
|
||||
void on_checkVSync_clicked(bool val);
|
||||
void on_spinSamples_valueChanged(int arg1);
|
||||
void on_buttonHDRClear_clicked();
|
||||
void on_buttonHDRSelect_clicked();
|
||||
void on_colorFogBack_colorChanged(const QColor &color);
|
||||
void on_spinFogDensity_valueChanged(double arg1);
|
||||
void on_spinFogDecay_valueChanged(double arg1);
|
||||
};
|
||||
|
||||
#endif // VIEW_EDITOR_H
|
||||
|
||||
@@ -29,9 +29,6 @@
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@@ -78,9 +75,6 @@
|
||||
<property name="text">
|
||||
<string>Gamma:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
@@ -181,22 +175,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="spinSamples">
|
||||
<property name="prefix">
|
||||
<string>Samples: </string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@@ -238,9 +216,6 @@
|
||||
<property name="text">
|
||||
<string>FOV:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -265,9 +240,6 @@
|
||||
<property name="text">
|
||||
<string>Depth start:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -415,17 +387,14 @@
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Density:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="SpinSlider" name="spinFogDensity">
|
||||
@@ -449,27 +418,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ColorButton" name="colorFogBack">
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>128</red>
|
||||
<green>128</green>
|
||||
<blue>128</blue>
|
||||
</color>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string>Decay:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="SpinSlider" name="spinFogDecay">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
@@ -497,6 +455,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="ColorButton" name="colorFogBack">
|
||||
<property name="color">
|
||||
<color>
|
||||
<red>128</red>
|
||||
<green>128</green>
|
||||
<blue>128</blue>
|
||||
</color>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -531,7 +507,6 @@
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../qad/libs/blockview/qad_blockview.qrc"/>
|
||||
<include location="../../qad/libs/blockview/qad_blockview.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user