46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <QObject>
|
||
|
|
|
||
|
|
#include <osgViewer/View>
|
||
|
|
#include <QWidget>
|
||
|
|
|
||
|
|
class OsgCameraManipulator;
|
||
|
|
|
||
|
|
class OsgView : public QObject {
|
||
|
|
public:
|
||
|
|
OsgView(QObject* parent = nullptr) noexcept;
|
||
|
|
~OsgView();
|
||
|
|
|
||
|
|
void InitGraphiceWindow(int x, int y, int width, int height,
|
||
|
|
WId windowHandle, const char* name = "",
|
||
|
|
bool windowDecoration = false);
|
||
|
|
void InitView(osgViewer::View* pView);
|
||
|
|
osgViewer::View* GetView(void) const;
|
||
|
|
void Resize(int x, int y, int width, int height);
|
||
|
|
void MouseMotion(int x, int y);
|
||
|
|
void MousePress(int x, int y, unsigned int button);
|
||
|
|
void MouseRelease(int x, int y, unsigned int button);
|
||
|
|
void MouseWheel(int wheel);
|
||
|
|
void KeyPress(QKeyEvent* keyInput);
|
||
|
|
void KeyRelease(QKeyEvent* keyInput);
|
||
|
|
void SetKeyModifiers(int mask);
|
||
|
|
|
||
|
|
void Initialize(OsgCameraManipulator* cameraManipulator);
|
||
|
|
void Uninitialize(void);
|
||
|
|
|
||
|
|
bool SetCameraManipulator(OsgCameraManipulator* cameraManipulator);
|
||
|
|
OsgCameraManipulator* GetCameraManipulator(void) const {
|
||
|
|
return cameraManipulator_;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected:
|
||
|
|
osgGA::EventQueue* GetEventQueue() const;
|
||
|
|
|
||
|
|
private:
|
||
|
|
osg::ref_ptr<osg::GraphicsContext> graphiceWindow_;
|
||
|
|
osg::ref_ptr<osgViewer::View> view_;
|
||
|
|
OsgCameraManipulator* cameraManipulator_{ nullptr };
|
||
|
|
bool initialized_{ false };
|
||
|
|
};
|