c913f00d21
Changed this back to setup_example since WIN32 flag is now supported. MFC_OSG.h: Added flag to indicate when the rendering thread has exited. MFC_OSG.cpp: Code modifications to support rendering flag thread exit. MFC_OSG_MDIView.cpp: Change to OnDestroy function to wait until we get render thread exit flag is true before we close the window. Main Exit Process: User presses escape button Viewer captures escape button and stops threading etc. Viewer sets Done when shutdown is complete MFC Render Thread monitors viewer->done for true MFC Render Thread exits while loop and sets MFC Done flag MFC View Window monitors MFC Done flag and then closes/destroys the window "
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <osgViewer/Viewer>
|
|
#include <osgViewer/StatsHandler>
|
|
#include <osgViewer/api/win32/GraphicsWindowWin32>
|
|
#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);
|
|
~cOSG(){};
|
|
|
|
void InitOSG(std::string filename);
|
|
void InitManipulators(void);
|
|
void InitSceneGraph(void);
|
|
void InitCameraConfig(void);
|
|
void SetupWindow(void);
|
|
void SetupCamera(void);
|
|
void PreFrameUpdate(void);
|
|
void PostFrameUpdate(void);
|
|
void Done(bool value) { mDone = value; }
|
|
bool Done(void) { return mDone; }
|
|
static void Render(void* ptr);
|
|
|
|
osgViewer::Viewer* getViewer() { return mViewer.get(); }
|
|
|
|
private:
|
|
bool mDone;
|
|
std::string m_ModelName;
|
|
HWND m_hWnd;
|
|
osg::ref_ptr<osgViewer::Viewer> mViewer;
|
|
osg::ref_ptr<osg::Group> mRoot;
|
|
osg::ref_ptr<osg::Node> mModel;
|
|
osg::ref_ptr<osgGA::TrackballManipulator> trackball;
|
|
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator;
|
|
};
|