Changed: #1193 Added camera control panel.
This commit is contained in:
parent
3746c92c86
commit
4baece714a
13 changed files with 540 additions and 193 deletions
|
@ -22,7 +22,7 @@ SET(OBJECT_VIEWER_HDR main_window.h graphics_viewport.h animation_dialog.h
|
|||
vegetable_dialog.h global_wind_dialog.h day_night_dialog.h sun_color_dialog.h
|
||||
vegetable_noise_value_widget.h vegetable_density_page.h vegetable_landscape_page.h
|
||||
vegetable_scale_page.h vegetable_appearance_page.h vegetable_rotate_page.h
|
||||
tune_mrm_dialog.h tune_timer_dialog.h
|
||||
tune_mrm_dialog.h tune_timer_dialog.h camera_control.h
|
||||
extension_system/iplugin_manager.h extension_system/plugin_manager.h)
|
||||
|
||||
SET(OBJECT_VIEWER_UIS animation_form.ui animation_set_form.ui settings_form.ui
|
||||
|
|
281
code/nel/tools/3d/object_viewer_qt/src/camera_control.cpp
Normal file
281
code/nel/tools/3d/object_viewer_qt/src/camera_control.cpp
Normal file
|
@ -0,0 +1,281 @@
|
|||
/*
|
||||
Object Viewer Qt
|
||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "stdpch.h"
|
||||
#include "camera_control.h"
|
||||
|
||||
// STL includes
|
||||
|
||||
// Qt includes
|
||||
|
||||
// NeL includes
|
||||
#include "nel/misc/debug.h"
|
||||
#include "nel/3d/u_driver.h"
|
||||
#include "nel/3d/u_scene.h"
|
||||
#include <nel/3d/u_camera.h>
|
||||
#include <nel/3d/u_3d_mouse_listener.h>
|
||||
|
||||
// Project includes
|
||||
#include "modules.h"
|
||||
|
||||
static int camId = 0;
|
||||
|
||||
namespace NLQT
|
||||
{
|
||||
|
||||
CCameraItem::CCameraItem(const QString &name):
|
||||
_cameraFocal(75),
|
||||
_speed(5.0),
|
||||
_active(false),
|
||||
_name(name)
|
||||
{
|
||||
_camera = Modules::objView().getScene()->createCamera();
|
||||
_camera.setTransformMode (NL3D::UTransformable::DirectMatrix);
|
||||
reset();
|
||||
}
|
||||
|
||||
CCameraItem::~CCameraItem()
|
||||
{
|
||||
}
|
||||
|
||||
void CCameraItem::setActive(bool active)
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
sint w = Modules::objView().getDriver()->getWindowWidth();
|
||||
sint h = Modules::objView().getDriver()->getWindowHeight();
|
||||
_camera.setPerspective(_cameraFocal * float(NLMISC::Pi) / 180.f, float(w) / h, 0.1f, 1000);
|
||||
Modules::objView().getScene()->setCam(_camera);
|
||||
setupListener();
|
||||
}
|
||||
else
|
||||
{
|
||||
_hotSpot = Modules::objView().get3dMouseListener()->getHotSpot();
|
||||
}
|
||||
_active = active;
|
||||
}
|
||||
|
||||
void CCameraItem::setSpeed(float value)
|
||||
{
|
||||
_speed = value;
|
||||
Modules::objView().get3dMouseListener()->setSpeed(_speed);
|
||||
}
|
||||
|
||||
void CCameraItem::reset()
|
||||
{
|
||||
_hotSpot = NLMISC::CVector(0, 0, 0);
|
||||
float radius=10.f;
|
||||
|
||||
// Setup camera
|
||||
_camera.lookAt(_hotSpot + NLMISC::CVector(0.57735f, 0.57735f, 0.57735f) * radius, _hotSpot);
|
||||
|
||||
if (_active)
|
||||
setupListener();
|
||||
}
|
||||
|
||||
void CCameraItem::setupListener()
|
||||
{
|
||||
NL3D::U3dMouseListener *_mouseListener = Modules::objView().get3dMouseListener();
|
||||
_mouseListener->setMatrix (_camera.getMatrix());
|
||||
_mouseListener->setFrustrum (_camera.getFrustum());
|
||||
_mouseListener->setViewport (NL3D::CViewport());
|
||||
_mouseListener->setHotSpot (_hotSpot);
|
||||
Modules::objView().get3dMouseListener()->setSpeed(_speed);
|
||||
}
|
||||
|
||||
CCameraControl::CCameraControl(QWidget *parent)
|
||||
: QObject(parent),
|
||||
_currentCamera(0)
|
||||
{
|
||||
_camToolBar = new QToolBar(tr("CameraControl"), parent);
|
||||
|
||||
_fpsAction = _camToolBar->addAction(tr("Fly"));
|
||||
_fpsAction->setStatusTip(tr("Set firstPerson camera mode"));
|
||||
_fpsAction->setCheckable(true);
|
||||
|
||||
_edit3dAction = _camToolBar->addAction(tr("Edit"));
|
||||
_edit3dAction->setStatusTip(tr("Set edit3d camera mode"));
|
||||
_edit3dAction->setCheckable(true);
|
||||
|
||||
QActionGroup *cameraModeGroup = new QActionGroup(this);
|
||||
cameraModeGroup->addAction(_fpsAction);
|
||||
cameraModeGroup->addAction(_edit3dAction);
|
||||
_edit3dAction->setChecked(true);
|
||||
|
||||
connect(_fpsAction, SIGNAL(triggered()), this, SLOT(setFirstPersonMode()));
|
||||
connect(_edit3dAction, SIGNAL(triggered()), this, SLOT(setEditMode()));
|
||||
|
||||
_renderModeMenu = new QMenu(tr("Render Mode"), _camToolBar);
|
||||
_renderModeMenu->setIcon(QIcon(":/images/polymode.png"));
|
||||
_camToolBar->addAction(_renderModeMenu->menuAction());
|
||||
connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode()));
|
||||
|
||||
QSignalMapper *modeMapper = new QSignalMapper(this);
|
||||
|
||||
_pointRenderModeAction = _renderModeMenu->addAction(tr("Point mode"));
|
||||
_pointRenderModeAction->setIcon(QIcon(":/images/rmpoints.png"));
|
||||
_pointRenderModeAction->setStatusTip(tr("Set point render mode"));
|
||||
connect(_pointRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
|
||||
modeMapper->setMapping(_pointRenderModeAction, 0);
|
||||
|
||||
_lineRenderModeAction = _renderModeMenu->addAction(tr("Line mode"));
|
||||
_lineRenderModeAction->setStatusTip(tr("Set line render mode"));
|
||||
_lineRenderModeAction->setIcon(QIcon(":/images/rmline.png"));
|
||||
connect(_lineRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
|
||||
modeMapper->setMapping(_lineRenderModeAction, 1);
|
||||
|
||||
_fillRenderModeAction = _renderModeMenu->addAction(tr("Fill mode"));
|
||||
_fillRenderModeAction->setIcon(QIcon(":/images/rmfill.png"));
|
||||
_fillRenderModeAction->setStatusTip(tr("Set fill render mode"));
|
||||
connect(_fillRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map()));
|
||||
modeMapper->setMapping(_fillRenderModeAction, 2);
|
||||
|
||||
connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setRenderMode(int)));
|
||||
|
||||
_camToolBar->addSeparator();
|
||||
_speedLabel = new QLabel(tr("Speed:"), _camToolBar);
|
||||
_camToolBar->addWidget(_speedLabel);
|
||||
_speedSpinBox = new QSpinBox(_camToolBar);
|
||||
_speedSpinBox->setMinimum(1);
|
||||
_speedSpinBox->setMaximum(1000);
|
||||
_camToolBar->addWidget(_speedSpinBox);
|
||||
connect(_speedSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setSpeed(int)));
|
||||
|
||||
_camToolBar->addSeparator();
|
||||
_addCamAction = _camToolBar->addAction(tr("Create camera"));
|
||||
_addCamAction->setIcon(QIcon(":/images/cam_add.png"));
|
||||
_addCamAction->setStatusTip(tr("Create new camera"));
|
||||
connect(_addCamAction, SIGNAL(triggered()), this, SLOT(addCamera()));
|
||||
|
||||
_delCamAction = _camToolBar->addAction(tr("Delete camera"));
|
||||
_delCamAction->setIcon(QIcon(":/images/cam_del.png"));
|
||||
_delCamAction->setStatusTip(tr("Delete current camera"));
|
||||
connect(_delCamAction, SIGNAL(triggered()), this, SLOT(delCamera()));
|
||||
|
||||
_listCamComboBox = new QComboBox(_camToolBar);
|
||||
connect(_listCamComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeCamera(int)));
|
||||
_listCamComboBox->setCurrentIndex(createCamera(tr("defaultCamera")));
|
||||
_camToolBar->addWidget(_listCamComboBox);
|
||||
|
||||
_camToolBar->addSeparator();
|
||||
_resetCamAction = _camToolBar->addAction(tr("Reset camera"));
|
||||
_resetCamAction->setStatusTip(tr("Reset current camera"));
|
||||
//_resetCamAction->setShortcut(tr("Ctrl+R"));
|
||||
connect(_resetCamAction, SIGNAL(triggered()), this, SLOT(resetCamera()));
|
||||
}
|
||||
|
||||
CCameraControl::~CCameraControl()
|
||||
{
|
||||
}
|
||||
|
||||
void CCameraControl::setEditMode()
|
||||
{
|
||||
Modules::objView().get3dMouseListener()->setMouseMode(NL3D::U3dMouseListener::edit3d);
|
||||
}
|
||||
|
||||
void CCameraControl::setFirstPersonMode()
|
||||
{
|
||||
Modules::objView().get3dMouseListener()->setMouseMode(NL3D::U3dMouseListener::firstPerson);
|
||||
}
|
||||
|
||||
void CCameraControl::addCamera()
|
||||
{
|
||||
_listCamComboBox->setCurrentIndex(createCamera(tr("%1_Camera").arg(++camId)));
|
||||
}
|
||||
|
||||
void CCameraControl::delCamera()
|
||||
{
|
||||
int index = _listCamComboBox->currentIndex();
|
||||
_listCamComboBox->setCurrentIndex(index - 1);
|
||||
|
||||
_listCamComboBox->removeItem(index);
|
||||
delete _cameraList[index];
|
||||
_cameraList.erase(_cameraList.begin() + index);
|
||||
}
|
||||
|
||||
void CCameraControl::setSpeed(int value)
|
||||
{
|
||||
nlassert(_currentCamera);
|
||||
_currentCamera->setSpeed(value);
|
||||
}
|
||||
|
||||
void CCameraControl::changeCamera(int index)
|
||||
{
|
||||
if (_currentCamera)
|
||||
_currentCamera->setActive(false);
|
||||
|
||||
if (index == 0)
|
||||
_delCamAction->setEnabled(false);
|
||||
else
|
||||
_delCamAction->setEnabled(true);
|
||||
|
||||
_currentCamera = _cameraList[index];
|
||||
|
||||
nlassert(_currentCamera);
|
||||
_currentCamera->setActive(true);
|
||||
_speedSpinBox->setValue(int(_currentCamera->getSpeed()));
|
||||
}
|
||||
|
||||
void CCameraControl::setRenderMode(int value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
|
||||
break;
|
||||
case 1:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
|
||||
break;
|
||||
case 2:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCameraControl::setRenderMode()
|
||||
{
|
||||
switch (Modules::objView().getDriver()->getPolygonMode())
|
||||
{
|
||||
case NL3D::UDriver::Filled:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
|
||||
break;
|
||||
case NL3D::UDriver::Line:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
|
||||
break;
|
||||
case NL3D::UDriver::Point:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCameraControl::resetCamera()
|
||||
{
|
||||
nlassert(_currentCamera);
|
||||
_currentCamera->reset();
|
||||
}
|
||||
|
||||
int CCameraControl::createCamera(const QString &name)
|
||||
{
|
||||
CCameraItem *newCamera = new CCameraItem(name);
|
||||
_cameraList.push_back(newCamera);
|
||||
_listCamComboBox->addItem(newCamera->getName());
|
||||
return _cameraList.size() - 1;
|
||||
}
|
||||
|
||||
} /* namespace NLQT */
|
125
code/nel/tools/3d/object_viewer_qt/src/camera_control.h
Normal file
125
code/nel/tools/3d/object_viewer_qt/src/camera_control.h
Normal file
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
Object Viewer Qt
|
||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CAMERA_CONTROL_H
|
||||
#define CAMERA_CONTROL_H
|
||||
|
||||
// STL includes
|
||||
|
||||
// Qt includes
|
||||
#include <QtCore/QSignalMapper>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QSpinBox>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QToolBar>
|
||||
|
||||
// NeL includes
|
||||
#include <nel/3d/u_camera.h>
|
||||
#include "nel/misc/vector.h"
|
||||
|
||||
// Project includes
|
||||
|
||||
namespace NLQT
|
||||
{
|
||||
|
||||
class CCameraItem
|
||||
{
|
||||
public:
|
||||
CCameraItem(const QString &name);
|
||||
~CCameraItem();
|
||||
|
||||
void setSpeed(float value);
|
||||
float getSpeed()
|
||||
{
|
||||
return _speed;
|
||||
}
|
||||
void setActive(bool active);
|
||||
void setName(const QString &name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
QString getName() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
void reset();
|
||||
|
||||
private:
|
||||
void setupListener();
|
||||
|
||||
NL3D::UCamera _camera;
|
||||
NLMISC::CVector _hotSpot;
|
||||
|
||||
float _cameraFocal;
|
||||
float _speed;
|
||||
bool _active;
|
||||
QString _name;
|
||||
};
|
||||
|
||||
class CCameraControl: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CCameraControl(QWidget *parent = 0);
|
||||
~CCameraControl();
|
||||
|
||||
QToolBar *getToolBar() const
|
||||
{
|
||||
return _camToolBar;
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void setEditMode();
|
||||
void setFirstPersonMode();
|
||||
void addCamera();
|
||||
void delCamera();
|
||||
void setSpeed(int value);
|
||||
void changeCamera(int index);
|
||||
void setRenderMode(int value);
|
||||
void setRenderMode();
|
||||
void resetCamera();
|
||||
|
||||
private:
|
||||
int createCamera(const QString &name);
|
||||
|
||||
QAction *_fpsAction;
|
||||
QAction *_edit3dAction;
|
||||
QAction *_pointRenderModeAction;
|
||||
QAction *_lineRenderModeAction;
|
||||
QAction *_fillRenderModeAction;
|
||||
QAction *_addCamAction;
|
||||
QAction *_delCamAction;
|
||||
QAction *_resetCamAction;
|
||||
QSpinBox *_speedSpinBox;
|
||||
QComboBox *_listCamComboBox;
|
||||
QMenu *_renderModeMenu;
|
||||
QLabel *_speedLabel;
|
||||
QToolBar *_camToolBar;
|
||||
|
||||
CCameraItem *_currentCamera;
|
||||
std::vector<CCameraItem *> _cameraList;
|
||||
|
||||
}; /* class CCameraControl */
|
||||
|
||||
} /* namespace NLQT */
|
||||
|
||||
#endif // CAMERA_CONTROL_H
|
BIN
code/nel/tools/3d/object_viewer_qt/src/images/cam_add.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/cam_add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
BIN
code/nel/tools/3d/object_viewer_qt/src/images/cam_del.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/cam_del.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmfill.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmfill.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmline.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmline.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmpoints.png
Normal file
BIN
code/nel/tools/3d/object_viewer_qt/src/images/rmpoints.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
|
@ -49,6 +49,7 @@
|
|||
#include "sun_color_dialog.h"
|
||||
#include "tune_mrm_dialog.h"
|
||||
#include "tune_timer_dialog.h"
|
||||
#include "camera_control.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
@ -58,13 +59,13 @@ namespace NLQT
|
|||
|
||||
CMainWindow::CMainWindow(QWidget *parent)
|
||||
: QMainWindow(parent),
|
||||
_isGraphicsInitialized(false),
|
||||
_isGraphicsEnabled(false),
|
||||
_isSoundInitialized(false),
|
||||
_isSoundEnabled(false),
|
||||
_GraphicsViewport(NULL),
|
||||
_lastDir("."),
|
||||
_mouseMode(NL3D::U3dMouseListener::edit3d)
|
||||
_isGraphicsInitialized(false),
|
||||
_isGraphicsEnabled(false),
|
||||
_isSoundInitialized(false),
|
||||
_isSoundEnabled(false),
|
||||
_GraphicsViewport(NULL),
|
||||
_lastDir("."),
|
||||
_mouseMode(NL3D::U3dMouseListener::edit3d)
|
||||
{
|
||||
nldebug("CMainWindow::CMainWindow:");
|
||||
setObjectName("CMainWindow");
|
||||
|
@ -162,7 +163,7 @@ void CMainWindow::setVisible(bool visible)
|
|||
{
|
||||
QMainWindow::setVisible(true);
|
||||
if (_isSoundInitialized)
|
||||
Modules::sound().initGraphics();
|
||||
Modules::sound().initGraphics();
|
||||
_mainTimer->start();
|
||||
_statusBarTimer->start(1000);
|
||||
}
|
||||
|
@ -202,7 +203,7 @@ void CMainWindow::open()
|
|||
tr("NeL skeleton file (*.skel)"));
|
||||
|
||||
Q_FOREACH(QString fileName, list)
|
||||
loadFile(fileName, skelFileName);
|
||||
loadFile(fileName, skelFileName);
|
||||
|
||||
_AnimationSetDialog->updateListObject();
|
||||
_AnimationSetDialog->updateListAnim();
|
||||
|
@ -220,43 +221,6 @@ void CMainWindow::resetScene()
|
|||
_SkeletonTreeModel->resetTreeModel();
|
||||
}
|
||||
|
||||
void CMainWindow::changeRenderMode()
|
||||
{
|
||||
// Change render mode
|
||||
switch (Modules::objView().getDriver()->getPolygonMode())
|
||||
{
|
||||
case NL3D::UDriver::Filled:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line);
|
||||
break;
|
||||
case NL3D::UDriver::Line:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point);
|
||||
break;
|
||||
case NL3D::UDriver::Point:
|
||||
Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWindow::resetCamera()
|
||||
{
|
||||
Modules::objView().resetCamera();
|
||||
}
|
||||
|
||||
void CMainWindow::changeCameraMode()
|
||||
{
|
||||
switch (_mouseMode)
|
||||
{
|
||||
case NL3D::U3dMouseListener::edit3d:
|
||||
Modules::objView().get3dMouseListener()->setMouseMode(NL3D::U3dMouseListener::firstPerson);
|
||||
_mouseMode = NL3D::U3dMouseListener::firstPerson;
|
||||
break;
|
||||
case NL3D::U3dMouseListener::firstPerson:
|
||||
_mouseMode = NL3D::U3dMouseListener::edit3d;
|
||||
Modules::objView().get3dMouseListener()->setMouseMode(NL3D::U3dMouseListener::edit3d);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CMainWindow::reloadTextures()
|
||||
{
|
||||
Modules::objView().reloadTextures();
|
||||
|
@ -286,10 +250,10 @@ void CMainWindow::updateStatusBar()
|
|||
if (_isGraphicsInitialized)
|
||||
{
|
||||
_statusInfo->setText(QString("%1, Nb tri: %2 , Texture used (Mb): %3 , fps: %4 ").arg(
|
||||
Modules::objView().getDriver()->getVideocardInformation()).arg(
|
||||
_numTri).arg(
|
||||
_texMem, 0,'f',4).arg(
|
||||
_fps, 0,'f',2));
|
||||
Modules::objView().getDriver()->getVideocardInformation()).arg(
|
||||
_numTri).arg(
|
||||
_texMem, 0,'f',4).arg(
|
||||
_fps, 0,'f',2));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,18 +278,11 @@ void CMainWindow::createActions()
|
|||
_resetCameraAction = new QAction(tr("Reset camera"), this);
|
||||
_resetCameraAction->setShortcut(tr("Ctrl+R"));
|
||||
_resetCameraAction->setStatusTip(tr("Reset current camera"));
|
||||
connect(_resetCameraAction, SIGNAL(triggered()), this, SLOT(resetCamera()));
|
||||
|
||||
_renderModeAction = new QAction("Change render mode", this);
|
||||
_renderModeAction->setIcon(QIcon(":/images/polymode.png"));
|
||||
_renderModeAction->setShortcut(tr("Ctrl+M"));
|
||||
_renderModeAction->setStatusTip(tr("Change render mode (Line, Point, Filled)"));
|
||||
connect(_renderModeAction, SIGNAL(triggered()), this, SLOT(changeRenderMode()));
|
||||
|
||||
_cameraModeAction = new QAction("Change camera mode", this);
|
||||
_cameraModeAction->setShortcut(tr("Ctrl+W"));
|
||||
_cameraModeAction->setStatusTip(tr("Change camera mode (edit3d, firstPerson)"));
|
||||
connect(_cameraModeAction, SIGNAL(triggered()), this, SLOT(changeCameraMode()));
|
||||
|
||||
_resetSceneAction = new QAction(tr("&Reset scene"), this);
|
||||
_resetSceneAction->setStatusTip(tr("Reset current scene"));
|
||||
|
@ -366,7 +323,6 @@ void CMainWindow::createMenus()
|
|||
_viewMenu->addAction(_setBackColorAction);
|
||||
_viewMenu->addAction(_resetCameraAction);
|
||||
_viewMenu->addAction(_renderModeAction);
|
||||
_viewMenu->addAction(_cameraModeAction);
|
||||
_viewMenu->addAction(_SetupFog->toggleViewAction());
|
||||
|
||||
_sceneMenu = menuBar()->addMenu(tr("&Scene"));
|
||||
|
@ -457,6 +413,12 @@ void CMainWindow::createToolBars()
|
|||
_toolsBar->addAction(_TuneTimerDialog->toggleViewAction());
|
||||
_toolsBar->addAction(_SkeletonScaleDialog->toggleViewAction());
|
||||
_toolsBar->addAction(_TuneMRMDialog->toggleViewAction());
|
||||
|
||||
_cameraControl = new CCameraControl(this);
|
||||
this->addToolBar(_cameraControl->getToolBar());
|
||||
|
||||
connect(_resetCameraAction, SIGNAL(triggered()), _cameraControl, SLOT(resetCamera()));
|
||||
connect(_renderModeAction, SIGNAL(triggered()), _cameraControl, SLOT(setRenderMode()));
|
||||
}
|
||||
|
||||
void CMainWindow::createStatusBar()
|
||||
|
|
|
@ -56,6 +56,8 @@ class CSunColorDialog;
|
|||
class CTuneMRMDialog;
|
||||
class CTuneTimerDialog;
|
||||
|
||||
class CCameraControl;
|
||||
|
||||
class CMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -79,9 +81,6 @@ public:
|
|||
private Q_SLOTS:
|
||||
void open();
|
||||
void resetScene();
|
||||
void changeRenderMode();
|
||||
void resetCamera();
|
||||
void changeCameraMode();
|
||||
void reloadTextures();
|
||||
void settings();
|
||||
void about();
|
||||
|
@ -122,6 +121,8 @@ private:
|
|||
CSkeletonTreeModel *_SkeletonTreeModel;
|
||||
CTuneTimerDialog *_TuneTimerDialog;
|
||||
|
||||
CCameraControl *_cameraControl;
|
||||
|
||||
QPalette _originalPalette;
|
||||
QString _lastDir;
|
||||
|
||||
|
@ -143,7 +144,6 @@ private:
|
|||
QAction *_frameDelayAction;
|
||||
QAction *_lightGroupAction;
|
||||
QAction *_reloadTexturesAction;
|
||||
QAction *_cameraModeAction;
|
||||
QAction *_resetCameraAction;
|
||||
QAction *_resetSceneAction;
|
||||
QAction *_saveScreenshotAction;
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
// STL includes
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/common.h>
|
||||
#include <nel/misc/debug.h>
|
||||
#include <nel/misc/file.h>
|
||||
#include <nel/misc/bitmap.h>
|
||||
|
@ -59,13 +58,13 @@ namespace NLQT
|
|||
|
||||
CObjectViewer::CObjectViewer()
|
||||
: _IDriver(0),
|
||||
_CScene(0),
|
||||
_Driver(0),
|
||||
_Scene(0),
|
||||
_TextContext(0),
|
||||
_CameraFocal(75),
|
||||
_CurrentInstance(""),
|
||||
_BloomEffect(false)
|
||||
_CScene(0),
|
||||
_Driver(0),
|
||||
_Scene(0),
|
||||
_TextContext(0),
|
||||
_CameraFocal(75),
|
||||
_CurrentInstance(""),
|
||||
_BloomEffect(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -115,19 +114,11 @@ void CObjectViewer::init(nlWindow wnd, uint16 w, uint16 h)
|
|||
|
||||
_Scene->enableLightingSystem(true);
|
||||
|
||||
// create the camera
|
||||
UCamera camera = _Scene->getCam();
|
||||
camera.setTransformMode (UTransformable::DirectMatrix);
|
||||
|
||||
setSizeViewport(w, h);
|
||||
|
||||
NLMISC::CVector hotSpot=NLMISC::CVector(0,0,0);
|
||||
|
||||
_MouseListener = _Driver->create3dMouseListener();
|
||||
_MouseListener->setMouseMode(U3dMouseListener::edit3d);
|
||||
|
||||
resetCamera();
|
||||
|
||||
// set the cache size for the font manager(in bytes)
|
||||
_Driver->setFontManagerMaxMemory(2097152);
|
||||
|
||||
|
@ -252,21 +243,6 @@ void CObjectViewer::reloadTextures()
|
|||
}
|
||||
}
|
||||
|
||||
void CObjectViewer::resetCamera()
|
||||
{
|
||||
CVector hotSpot = CVector (0,0,0);
|
||||
float radius=10.f;
|
||||
|
||||
// Setup camera
|
||||
_Scene->getCam().lookAt(hotSpot + CVector(0.57735f, 0.57735f, 0.57735f) * radius, hotSpot);
|
||||
|
||||
// Setup mouse listener
|
||||
_MouseListener->setMatrix (_Scene->getCam().getMatrix());
|
||||
_MouseListener->setFrustrum (_Scene->getCam().getFrustum());
|
||||
_MouseListener->setViewport (CViewport());
|
||||
_MouseListener->setHotSpot (hotSpot);
|
||||
}
|
||||
|
||||
void CObjectViewer::saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga)
|
||||
{
|
||||
//H_AUTO2
|
||||
|
|
|
@ -100,8 +100,6 @@ public:
|
|||
|
||||
void reloadTextures();
|
||||
|
||||
void resetCamera();
|
||||
|
||||
/// Make a screenshot of the current scene and save.
|
||||
void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga);
|
||||
|
||||
|
|
|
@ -37,6 +37,11 @@
|
|||
<file>images/save.png</file>
|
||||
<file>images/insert-horizontal.png</file>
|
||||
<file>images/polymode.png</file>
|
||||
<file>images/rmfill.png</file>
|
||||
<file>images/rmline.png</file>
|
||||
<file>images/rmpoints.png</file>
|
||||
<file>images/cam_del.png</file>
|
||||
<file>images/cam_add.png</file>
|
||||
|
||||
<file>images/Emitter.bmp</file>
|
||||
<file>images/Force.bmp</file>
|
||||
|
|
Loading…
Reference in a new issue