2007-05-11 16:19:46 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <osgViewer/Viewer>
|
2007-06-07 00:23:20 +08:00
|
|
|
#include <osgViewer/ViewerEventHandlers>
|
2007-05-17 19:04:57 +08:00
|
|
|
#include <osgViewer/api/win32/GraphicsWindowWin32>
|
2007-05-11 16:19:46 +08:00
|
|
|
#include <osgGA/TrackballManipulator>
|
|
|
|
#include <osgGA/KeySwitchMatrixManipulator>
|
|
|
|
#include <osgDB/DatabasePager>
|
|
|
|
#include <osgDB/Registry>
|
|
|
|
#include <osgDB/ReadFile>
|
|
|
|
#include <osgUtil/Optimizer>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
class cOSG
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cOSG(HWND hWnd);
|
2007-07-24 04:37:49 +08:00
|
|
|
~cOSG();
|
2007-05-11 16:19:46 +08:00
|
|
|
|
|
|
|
void InitOSG(std::string filename);
|
|
|
|
void InitManipulators(void);
|
|
|
|
void InitSceneGraph(void);
|
|
|
|
void InitCameraConfig(void);
|
|
|
|
void SetupWindow(void);
|
|
|
|
void SetupCamera(void);
|
2007-05-17 19:04:57 +08:00
|
|
|
void PreFrameUpdate(void);
|
|
|
|
void PostFrameUpdate(void);
|
2007-06-02 05:28:18 +08:00
|
|
|
void Done(bool value) { mDone = value; }
|
|
|
|
bool Done(void) { return mDone; }
|
2011-09-12 18:47:59 +08:00
|
|
|
//static void Render(void* ptr);
|
2007-05-11 16:19:46 +08:00
|
|
|
|
2007-07-24 04:37:49 +08:00
|
|
|
osgViewer::Viewer* getViewer() { return mViewer; }
|
2007-05-11 16:19:46 +08:00
|
|
|
|
|
|
|
private:
|
2007-06-02 05:28:18 +08:00
|
|
|
bool mDone;
|
2007-05-11 16:19:46 +08:00
|
|
|
std::string m_ModelName;
|
|
|
|
HWND m_hWnd;
|
2007-07-24 04:37:49 +08:00
|
|
|
osgViewer::Viewer* mViewer;
|
2007-05-11 16:19:46 +08:00
|
|
|
osg::ref_ptr<osg::Group> mRoot;
|
|
|
|
osg::ref_ptr<osg::Node> mModel;
|
|
|
|
osg::ref_ptr<osgGA::TrackballManipulator> trackball;
|
|
|
|
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator;
|
2007-05-17 19:04:57 +08:00
|
|
|
};
|
2011-09-12 18:47:59 +08:00
|
|
|
|
|
|
|
class CRenderingThread : public OpenThreads::Thread
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CRenderingThread( cOSG* ptr );
|
|
|
|
virtual ~CRenderingThread();
|
|
|
|
|
|
|
|
virtual void run();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
cOSG* _ptr;
|
|
|
|
bool _done;
|
|
|
|
};
|