camera fixes
git-svn-id: svn://db.shs.com.ru/libs@603 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "globject_editor.h"
|
||||
#include "ui_globject_editor.h"
|
||||
#include "glcamera.h"
|
||||
|
||||
|
||||
GLObjectEditor::GLObjectEditor(QWidget * parent): QWidget(parent) {
|
||||
@@ -27,6 +28,9 @@ GLObjectEditor::GLObjectEditor(QWidget * parent): QWidget(parent) {
|
||||
object = 0;
|
||||
rmodes << GLObjectBase::View << GLObjectBase::Point << GLObjectBase::Line << GLObjectBase::Fill;
|
||||
ui->groupLight->setEnabled(false);
|
||||
ui->groupLight->setVisible(false);
|
||||
ui->groupCamera->setEnabled(false);
|
||||
ui->groupCamera->setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +51,9 @@ void GLObjectEditor::setObject(GLObjectBase * o) {
|
||||
object = o;
|
||||
if (object == 0) {
|
||||
ui->groupLight->setEnabled(false);
|
||||
ui->groupLight->setVisible(false);
|
||||
ui->groupCamera->setEnabled(false);
|
||||
ui->groupCamera->setVisible(false);
|
||||
return;
|
||||
}
|
||||
ui->buttonDiscardRawMatrix->setEnabled(o->isRawMatrix());
|
||||
@@ -68,6 +75,7 @@ void GLObjectEditor::setObject(GLObjectBase * o) {
|
||||
ui->checkReceiveShadows->setChecked(object->isReceiveShadows());
|
||||
ui->comboRenderMode->setCurrentIndex(rmodes.indexOf(object->renderMode()));
|
||||
ui->groupLight->setEnabled(object->type() == GLObjectBase::glLight);
|
||||
ui->groupLight->setVisible(object->type() == GLObjectBase::glLight);
|
||||
if (object->type() == GLObjectBase::glLight) {
|
||||
Light * l = globject_cast<Light * >(object);
|
||||
//bool is_dir = l->light_type == Light::Directional, is_cone = l->light_type == Light::Cone;
|
||||
@@ -83,6 +91,16 @@ void GLObjectEditor::setObject(GLObjectBase * o) {
|
||||
ui->spinLightDirectionY->setValue(l->direction.y());
|
||||
ui->spinLightDirectionZ->setValue(l->direction.z());
|
||||
}
|
||||
ui->groupCamera->setEnabled(object->type() == GLObjectBase::glCamera);
|
||||
ui->groupCamera->setVisible(object->type() == GLObjectBase::glCamera);
|
||||
if (object->type() == GLObjectBase::glCamera) {
|
||||
Camera * c = globject_cast<Camera * >(object);
|
||||
ui->checkCameraMirrorX->setChecked(c->isMirrorX());
|
||||
ui->checkCameraMirrorY->setChecked(c->isMirrorY());
|
||||
ui->spinCameraFOV->setValue(c->FOV());
|
||||
ui->spinCameraDepthStart->setValue(c->depthStart());
|
||||
ui->spinCameraDepthEnd->setValue(c->depthEnd());
|
||||
}
|
||||
active = true;
|
||||
}
|
||||
|
||||
@@ -120,6 +138,14 @@ void GLObjectEditor::objectChanged() {
|
||||
l->angle_end = ui->spinLightAngleEnd->value();
|
||||
l->direction = QVector3D(ui->spinLightDirectionX->value(), ui->spinLightDirectionY->value(), ui->spinLightDirectionZ->value()).normalized();
|
||||
}
|
||||
if (object->type() == GLObjectBase::glCamera) {
|
||||
Camera * c = globject_cast<Camera * >(object);
|
||||
c->setMirrorX(ui->checkCameraMirrorX->isChecked());
|
||||
c->setMirrorY(ui->checkCameraMirrorY->isChecked());
|
||||
c->setFOV(ui->spinCameraFOV->value());
|
||||
c->setDepthStart(ui->spinCameraDepthStart->value());
|
||||
c->setDepthEnd(ui->spinCameraDepthEnd->value());
|
||||
}
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user