25 #ifndef WGRAPHICSENGINE_H
26 #define WGRAPHICSENGINE_H
31 #include <boost/shared_ptr.hpp>
32 #include <boost/signals2/signal.hpp>
33 #include <boost/thread/mutex.hpp>
36 #include <osg/Texture3D>
39 #include <osg/ref_ptr>
40 #include <osgViewer/CompositeViewer>
42 #include "../common/WThreadedRunner.h"
43 #include "../common/WConditionOneShot.h"
44 #include "../common/WColor.h"
45 #include "WGEGraphicsWindow.h"
47 #include "WGEViewer.h"
48 #include "WGESignals.h"
84 boost::shared_ptr< WGEViewer >
createViewer( std::string name, osg::ref_ptr<osg::Referenced> wdata,
int x,
int y,
86 WColor bgColor = WColor( 1.0, 1.0, 1.0, 1.0 ) );
108 boost::shared_ptr< WGEViewer >
getViewer();
130 boost::signals2::connection
subscribeSignal( GE_SIGNAL signal, t_GEGenericSignalHandlerType notifier );
194 std::map< std::string, boost::shared_ptr< WGEViewer > >
m_viewers;
244 #endif // WGRAPHICSENGINE_H
boost::shared_ptr< WGEViewer > createViewer(std::string name, osg::ref_ptr< osg::Referenced > wdata, int x, int y, int width, int height, WGECamera::ProjectionMode projectionMode=WGECamera::ORTHOGRAPHIC, WColor bgColor=WColor(1.0, 1.0, 1.0, 1.0))
Creates a new viewer.
static bool isRunning()
Checks whether the graphics engine is currently running or not.
static boost::shared_ptr< WGraphicsEngine > m_instance
Singleton instance of WGraphicsEngine.
WConditionOneShot m_startThreadingCondition
This condition is fired externally if all the GUI startup is done to ensure all OGL stuff is initiali...
void requestShaderReload()
This requests all shaders to reload during the next update cycle.
virtual void threadMain()
Handler for repainting and event handling.
Implements a WCondition, but can be fired only ONCE.
ProjectionMode
List of possible camera modes.
virtual ~WGraphicsEngine()
Destructor.
osg::ref_ptr< WGEScene > getScene()
Returns the root node of the WGraphicsEngine (this is not the root node of the OSG).
Base class for all classes needing to be executed in a separate thread.
boost::mutex m_viewersLock
Mutex used to lock the map of viewers.
virtual void notifyStop()
Gets called when the thread should be stopped.
bool isMultiThreadedViews() const
Checks whether the viewers work multithreaded.
static boost::shared_ptr< WGraphicsEngine > getGraphicsEngine()
Returns instance of the graphics engine.
boost::shared_ptr< WGEViewer > getViewer()
Returns the unnamed view, which is the view for the default scene which can be acquired using getScen...
Base class for initializing the graphics engine.
void closeViewer(const std::string name)
Closes a viewer and deletes it from the list of viewers.
std::map< std::string, boost::shared_ptr< WGEViewer > > m_viewers
All registered viewers.
WGraphicsEngine()
Constructors are protected because this is a Singleton.
void finalizeStartup()
Function notifies the viewer threads (if any) to start.
bool m_running
True if graphics engine is running.
void setMultiThreadedViews(bool enable=true)
Enables multithreaded view.
void waitForFinalize()
Wait until someone called finalizeStartup().
osg::ref_ptr< osgViewer::CompositeViewer > m_viewer
OpenSceneGraph composite viewer.
osg::ref_ptr< WGEScene > m_rootNode
OpenSceneGraph root node.
static bool waitForStartupComplete()
Waits for the GE to come up.
t_GEGenericSignalType m_reloadShadersSignal
Signal getting emitted whenever a reload shader request is waiting.
boost::signals2::connection subscribeSignal(GE_SIGNAL signal, t_GEGenericSignalHandlerType notifier)
Subscribe a specified handler to the specified signal emited by the GE.
boost::shared_ptr< WGEViewer > getViewerByName(std::string name)
Searches for a viewer with a given name and returns it, if found.