|
|
@ -47,118 +47,118 @@ namespace CSVRender
|
|
|
|
|
|
|
|
|
|
|
|
class RenderWidget : public QWidget
|
|
|
|
class RenderWidget : public QWidget
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
RenderWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
|
|
|
RenderWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
|
|
|
virtual ~RenderWidget();
|
|
|
|
virtual ~RenderWidget();
|
|
|
|
|
|
|
|
|
|
|
|
void flagAsModified();
|
|
|
|
void flagAsModified();
|
|
|
|
|
|
|
|
|
|
|
|
void setVisibilityMask(int mask);
|
|
|
|
void setVisibilityMask(int mask);
|
|
|
|
|
|
|
|
|
|
|
|
osg::Camera *getCamera();
|
|
|
|
osg::Camera *getCamera();
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
osg::ref_ptr<osgViewer::View> mView;
|
|
|
|
osg::ref_ptr<osgViewer::View> mView;
|
|
|
|
|
|
|
|
|
|
|
|
osg::Group* mRootNode;
|
|
|
|
osg::Group* mRootNode;
|
|
|
|
|
|
|
|
|
|
|
|
QTimer mTimer;
|
|
|
|
QTimer mTimer;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Extension of RenderWidget to support lighting mode selection & toolbar
|
|
|
|
// Extension of RenderWidget to support lighting mode selection & toolbar
|
|
|
|
class SceneWidget : public RenderWidget
|
|
|
|
class SceneWidget : public RenderWidget
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
SceneWidget(boost::shared_ptr<Resource::ResourceSystem> resourceSystem, QWidget* parent = 0,
|
|
|
|
SceneWidget(boost::shared_ptr<Resource::ResourceSystem> resourceSystem, QWidget* parent = 0,
|
|
|
|
Qt::WindowFlags f = 0, bool retrieveInput = true);
|
|
|
|
Qt::WindowFlags f = 0, bool retrieveInput = true);
|
|
|
|
virtual ~SceneWidget();
|
|
|
|
virtual ~SceneWidget();
|
|
|
|
|
|
|
|
|
|
|
|
CSVWidget::SceneToolMode *makeLightingSelector (CSVWidget::SceneToolbar *parent);
|
|
|
|
CSVWidget::SceneToolMode *makeLightingSelector (CSVWidget::SceneToolbar *parent);
|
|
|
|
///< \attention The created tool is not added to the toolbar (via addTool). Doing that
|
|
|
|
///< \attention The created tool is not added to the toolbar (via addTool). Doing that
|
|
|
|
/// is the responsibility of the calling function.
|
|
|
|
/// is the responsibility of the calling function.
|
|
|
|
|
|
|
|
|
|
|
|
void setDefaultAmbient (const osg::Vec4f& colour);
|
|
|
|
void setDefaultAmbient (const osg::Vec4f& colour);
|
|
|
|
///< \note The actual ambient colour may differ based on lighting settings.
|
|
|
|
///< \note The actual ambient colour may differ based on lighting settings.
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
protected:
|
|
|
|
void setLighting (Lighting *lighting);
|
|
|
|
void setLighting (Lighting *lighting);
|
|
|
|
///< \attention The ownership of \a lighting is not transferred to *this.
|
|
|
|
///< \attention The ownership of \a lighting is not transferred to *this.
|
|
|
|
|
|
|
|
|
|
|
|
void setAmbient(const osg::Vec4f& ambient);
|
|
|
|
void setAmbient(const osg::Vec4f& ambient);
|
|
|
|
|
|
|
|
|
|
|
|
virtual void mousePressEvent (QMouseEvent *event);
|
|
|
|
virtual void mousePressEvent (QMouseEvent *event);
|
|
|
|
virtual void mouseReleaseEvent (QMouseEvent *event);
|
|
|
|
virtual void mouseReleaseEvent (QMouseEvent *event);
|
|
|
|
virtual void mouseMoveEvent (QMouseEvent *event);
|
|
|
|
virtual void mouseMoveEvent (QMouseEvent *event);
|
|
|
|
virtual void wheelEvent (QWheelEvent *event);
|
|
|
|
virtual void wheelEvent (QWheelEvent *event);
|
|
|
|
virtual void keyPressEvent (QKeyEvent *event);
|
|
|
|
virtual void keyPressEvent (QKeyEvent *event);
|
|
|
|
virtual void keyReleaseEvent (QKeyEvent *event);
|
|
|
|
virtual void keyReleaseEvent (QKeyEvent *event);
|
|
|
|
|
|
|
|
|
|
|
|
/// \return Is \a key a button mapping setting? (ignored otherwise)
|
|
|
|
/// \return Is \a key a button mapping setting? (ignored otherwise)
|
|
|
|
virtual bool storeMappingSetting (const CSMPrefs::Setting *setting);
|
|
|
|
virtual bool storeMappingSetting (const CSMPrefs::Setting *setting);
|
|
|
|
|
|
|
|
|
|
|
|
std::string mapButton (QMouseEvent *event);
|
|
|
|
std::string mapButton (QMouseEvent *event);
|
|
|
|
|
|
|
|
|
|
|
|
boost::shared_ptr<Resource::ResourceSystem> mResourceSystem;
|
|
|
|
boost::shared_ptr<Resource::ResourceSystem> mResourceSystem;
|
|
|
|
|
|
|
|
|
|
|
|
Lighting* mLighting;
|
|
|
|
Lighting* mLighting;
|
|
|
|
|
|
|
|
|
|
|
|
osg::Vec4f mDefaultAmbient;
|
|
|
|
osg::Vec4f mDefaultAmbient;
|
|
|
|
bool mHasDefaultAmbient;
|
|
|
|
bool mHasDefaultAmbient;
|
|
|
|
LightingDay mLightingDay;
|
|
|
|
LightingDay mLightingDay;
|
|
|
|
LightingNight mLightingNight;
|
|
|
|
LightingNight mLightingNight;
|
|
|
|
LightingBright mLightingBright;
|
|
|
|
LightingBright mLightingBright;
|
|
|
|
|
|
|
|
|
|
|
|
int mPrevMouseX, mPrevMouseY;
|
|
|
|
int mPrevMouseX, mPrevMouseY;
|
|
|
|
std::string mMouseMode;
|
|
|
|
std::string mMouseMode;
|
|
|
|
std::auto_ptr<FreeCameraController> mFreeCamControl;
|
|
|
|
std::auto_ptr<FreeCameraController> mFreeCamControl;
|
|
|
|
std::auto_ptr<OrbitCameraController> mOrbitCamControl;
|
|
|
|
std::auto_ptr<OrbitCameraController> mOrbitCamControl;
|
|
|
|
CameraController* mCurrentCamControl;
|
|
|
|
CameraController* mCurrentCamControl;
|
|
|
|
|
|
|
|
|
|
|
|
std::map<std::pair<Qt::MouseButton, bool>, std::string> mButtonMapping;
|
|
|
|
std::map<std::pair<Qt::MouseButton, bool>, std::string> mButtonMapping;
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
public slots:
|
|
|
|
void update(double dt);
|
|
|
|
void update(double dt);
|
|
|
|
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
protected slots:
|
|
|
|
|
|
|
|
|
|
|
|
virtual void settingChanged (const CSMPrefs::Setting *setting);
|
|
|
|
virtual void settingChanged (const CSMPrefs::Setting *setting);
|
|
|
|
|
|
|
|
|
|
|
|
void selectNavigationMode (const std::string& mode);
|
|
|
|
void selectNavigationMode (const std::string& mode);
|
|
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
|
|
|
|
void selectLightingMode (const std::string& mode);
|
|
|
|
void selectLightingMode (const std::string& mode);
|
|
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
signals:
|
|
|
|
|
|
|
|
|
|
|
|
void focusToolbarRequest();
|
|
|
|
void focusToolbarRequest();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// There are rendering glitches when using multiple Viewer instances, work around using CompositeViewer with multiple views
|
|
|
|
// There are rendering glitches when using multiple Viewer instances, work around using CompositeViewer with multiple views
|
|
|
|
class CompositeViewer : public QObject, public osgViewer::CompositeViewer
|
|
|
|
class CompositeViewer : public QObject, public osgViewer::CompositeViewer
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
CompositeViewer();
|
|
|
|
CompositeViewer();
|
|
|
|
|
|
|
|
|
|
|
|
static CompositeViewer& get();
|
|
|
|
static CompositeViewer& get();
|
|
|
|
|
|
|
|
|
|
|
|
QTimer mTimer;
|
|
|
|
QTimer mTimer;
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
osg::Timer mFrameTimer;
|
|
|
|
osg::Timer mFrameTimer;
|
|
|
|
double mSimulationTime;
|
|
|
|
double mSimulationTime;
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
public slots:
|
|
|
|
void update();
|
|
|
|
void update();
|
|
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
signals:
|
|
|
|
void simulationUpdated(double dt);
|
|
|
|
void simulationUpdated(double dt);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|