Moved osgProducer and osgproducerviewer out into their own repository.
Clean up the source for remaining references to osgProducer/Producer.
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
// The following symbol has a underscore suffix for compatibility.
|
||||
#ifndef OSGPRODUCER_EXPORT_
|
||||
#define OSGPRODUCER_EXPORT_ 1
|
||||
|
||||
#if defined(WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
|
||||
#pragma warning( disable : 4244 )
|
||||
#pragma warning( disable : 4251 )
|
||||
#pragma warning( disable : 4267 )
|
||||
#pragma warning( disable : 4275 )
|
||||
#pragma warning( disable : 4290 )
|
||||
#pragma warning( disable : 4786 )
|
||||
#pragma warning( disable : 4305 )
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__)
|
||||
# if defined( OSG_LIBRARY_STATIC )
|
||||
# define OSGPRODUCER_EXPORT
|
||||
# elif defined( OSGPRODUCER_LIBRARY )
|
||||
# define OSGPRODUCER_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define OSGPRODUCER_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define OSGPRODUCER_EXPORT
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
\namespace osgProducer
|
||||
|
||||
The osgProducer is a utility library integrates OpenProducer to provide a general purpose viewer classes.
|
||||
osgProducer is used by all the OpenSceneGraph examples, and can also be used for client application development.
|
||||
|
||||
Note, the core scene graph libraries and NodeKits are entirely Windowing API agnostic so you are free to implement
|
||||
your own integration with whichever Windowing toolkit you prefer.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGPRODUCER_GRAPHICSCONTEXTIMPLEMENTATION
|
||||
#define OSGPRODUCER_GRAPHICSCONTEXTIMPLEMENTATION 1
|
||||
|
||||
|
||||
#include <osg/GraphicsContext>
|
||||
|
||||
#include <Producer/RenderSurface>
|
||||
|
||||
#include <osgProducer/Export>
|
||||
|
||||
|
||||
|
||||
namespace osgProducer {
|
||||
|
||||
class OSGPRODUCER_EXPORT GraphicsContextImplementation : public osg::GraphicsContext
|
||||
{
|
||||
public :
|
||||
|
||||
/** Construct a graphics context to specified traits.*/
|
||||
GraphicsContextImplementation(Traits* traits);
|
||||
|
||||
/** Construct a graphics context with specified RenderSurface.*/
|
||||
GraphicsContextImplementation(Producer::RenderSurface* rs);
|
||||
|
||||
/** Return true of graphics context is realized.*/
|
||||
|
||||
/** Return the RenderSurface that implements the graphics context.*/
|
||||
Producer::RenderSurface* getRenderSurface() { return _rs.get(); }
|
||||
|
||||
/** Return the const RenderSurface that implements the graphics context.*/
|
||||
const Producer::RenderSurface* getRenderSurface() const { return _rs.get(); }
|
||||
|
||||
/** Return whether a valid and usable GraphicsContext has been created - assume success.*/
|
||||
virtual bool valid() const { return true; }
|
||||
|
||||
/** Realise the GraphicsContext.*/
|
||||
virtual bool realizeImplementation();
|
||||
|
||||
/** Return true if the graphics context has been realised and is ready to use.*/
|
||||
virtual bool isRealizedImplementation() const { return _rs.valid() && _rs->isRealized(); }
|
||||
|
||||
/** Close the graphics context.*/
|
||||
virtual void closeImplementation();
|
||||
|
||||
/** Make this graphics context current.*/
|
||||
virtual bool makeCurrentImplementation();
|
||||
|
||||
/** Make this graphics context current with specified read context.*/
|
||||
virtual bool makeContextCurrentImplementation(osg::GraphicsContext* readContext);
|
||||
|
||||
/** Release the graphics context.*/
|
||||
virtual bool releaseContextImplementation();
|
||||
|
||||
/** Bind the graphics context to associated texture.*/
|
||||
virtual void bindPBufferToTextureImplementation(GLenum buffer);
|
||||
|
||||
/** swap the front and back buffers.*/
|
||||
virtual void swapBuffersImplementation();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~GraphicsContextImplementation();
|
||||
|
||||
bool _closeOnDestruction;
|
||||
osg::ref_ptr<Producer::RenderSurface> _rs;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,103 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGPRODUCER_EVENTCALLBACK
|
||||
#define OSGPRODUCER_EVENTCALLBACK 1
|
||||
|
||||
#include <OpenThreads/Mutex>
|
||||
|
||||
#include <osgProducer/Export> // To disable MSVC warnings
|
||||
|
||||
#include <Producer/RenderSurface> // For definition of KeySymbol
|
||||
#include <Producer/KeyboardMouse>
|
||||
#include <osgGA/EventQueue>
|
||||
|
||||
#include <osg/ref_ptr>
|
||||
#include <osg/Timer>
|
||||
|
||||
namespace osgProducer {
|
||||
|
||||
|
||||
class OSGPRODUCER_EXPORT KeyboardMouseCallback : public Producer::KeyboardMouseCallback
|
||||
{
|
||||
public:
|
||||
KeyboardMouseCallback(Producer::KeyboardMouse* keyboardMouse, bool &done, bool escapeKeySetsDone=true);
|
||||
|
||||
virtual ~KeyboardMouseCallback() {}
|
||||
|
||||
// override KeyboardMouseCallback methods.
|
||||
virtual void mouseScroll( Producer::KeyboardMouseCallback::ScrollingMotion sm );
|
||||
virtual void mouseScroll2D( float, float);
|
||||
virtual void penPressure(float pressure);
|
||||
virtual void penProximity(Producer::KeyboardMouseCallback::TabletPointerType, bool);
|
||||
virtual void mouseMotion( float mx, float my);
|
||||
virtual void passiveMouseMotion( float mx, float my);
|
||||
virtual void mouseWarp( float mx, float my);
|
||||
|
||||
virtual void buttonPress( float mx, float my, unsigned int mbutton );
|
||||
virtual void doubleButtonPress( float mx, float my, unsigned int mbutton);
|
||||
virtual void buttonRelease( float mx, float my, unsigned int mbutton );
|
||||
|
||||
virtual void keyPress( Producer::KeyCharacter key );
|
||||
virtual void keyRelease( Producer::KeyCharacter key );
|
||||
|
||||
virtual void specialKeyPress( Producer::KeyCharacter key);
|
||||
virtual void specialKeyRelease( Producer::KeyCharacter key);
|
||||
|
||||
virtual void windowConfig( int x, int y, unsigned int width, unsigned int height );
|
||||
|
||||
virtual void shutdown();
|
||||
|
||||
|
||||
void setEscapeSetDone(bool esc) { _escapeKeySetsDone = esc; }
|
||||
bool getEscapeSetDone() const { return _escapeKeySetsDone; }
|
||||
|
||||
|
||||
// local methods and members
|
||||
typedef osgGA::EventQueue::Events EventQueue;
|
||||
|
||||
void setEventQueue(osgGA::EventQueue* eventQueue) { _eventQueue = eventQueue; }
|
||||
osgGA::EventQueue* getEventQueue() { return _eventQueue.get(); }
|
||||
|
||||
bool takeEventQueue(EventQueue& queue);
|
||||
bool copyEventQueue(EventQueue& queue) const;
|
||||
void setEventQueue(EventQueue& queue);
|
||||
void appendEventQueue(EventQueue& queue);
|
||||
|
||||
bool done() const { return _done; }
|
||||
|
||||
double getTime() const { return _eventQueue->getTime(); }
|
||||
|
||||
Producer::KeyboardMouse* getKeyboardMouse() { return _keyboardMouse; }
|
||||
const Producer::KeyboardMouse* getKeyboardMouse() const { return _keyboardMouse; }
|
||||
|
||||
osgGA::GUIEventAdapter* createEventAdapter();
|
||||
|
||||
void updateWindowSize();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Producer::KeyboardMouse* _keyboardMouse;
|
||||
float _mx, _my;
|
||||
unsigned int _mbutton;
|
||||
bool &_done;
|
||||
bool _escapeKeySetsDone;
|
||||
|
||||
osg::ref_ptr<osgGA::EventQueue> _eventQueue;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,258 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGPRODUCER_OSGCAMERAGROUP_H
|
||||
#define OSGPRODUCER_OSGCAMERAGROUP_H 1
|
||||
|
||||
|
||||
#include <Producer/CameraConfig>
|
||||
#include <Producer/CameraGroup>
|
||||
|
||||
#include <osg/Timer>
|
||||
#include <osg/ArgumentParser>
|
||||
#include <osg/ApplicationUsage>
|
||||
#include <osg/Group>
|
||||
#include <osg/StateSet>
|
||||
#include <osg/FrameStamp>
|
||||
#include <osg/DisplaySettings>
|
||||
#include <osg/CullSettings>
|
||||
#include <osg/View>
|
||||
#include <osg/Matrixd>
|
||||
|
||||
#include <osgProducer/OsgSceneHandler>
|
||||
#include <osgProducer/GraphicsContextImplementation>
|
||||
|
||||
namespace osgProducer {
|
||||
|
||||
class OSGPRODUCER_EXPORT OsgCameraGroup : public Producer::CameraGroup
|
||||
{
|
||||
public :
|
||||
|
||||
typedef Producer::CameraGroup::ThreadModel ThreadingModel;
|
||||
|
||||
OsgCameraGroup();
|
||||
|
||||
OsgCameraGroup(Producer::CameraConfig *cfg);
|
||||
|
||||
OsgCameraGroup(const std::string& configFile);
|
||||
|
||||
OsgCameraGroup(osg::ArgumentParser& arguments);
|
||||
|
||||
virtual ~OsgCameraGroup();
|
||||
|
||||
|
||||
void setApplicationUsage(osg::ApplicationUsage* au) { _applicationUsage = au; }
|
||||
|
||||
osg::ApplicationUsage* getApplicationUsage() { return _applicationUsage; }
|
||||
|
||||
const osg::ApplicationUsage* getApplicationUsage() const { return _applicationUsage; }
|
||||
|
||||
|
||||
typedef std::vector< osg::ref_ptr<GraphicsContextImplementation> > GraphicsContextList;
|
||||
|
||||
void setGraphicsContextList(GraphicsContextList& gcList) { _gcList = gcList; }
|
||||
|
||||
GraphicsContextList& getGraphicsContextList() { return _gcList;}
|
||||
|
||||
const GraphicsContextList& getGraphicsContextList() const { return _gcList;}
|
||||
|
||||
|
||||
typedef std::vector < Producer::ref_ptr<osgProducer::OsgSceneHandler> > SceneHandlerList;
|
||||
|
||||
SceneHandlerList& getSceneHandlerList() { return _shvec;}
|
||||
|
||||
const SceneHandlerList& getSceneHandlerList() const { return _shvec;}
|
||||
|
||||
/** Set the scene data to be rendered. The scene graph traversal during
|
||||
* rendering will start at the node passed as parameter.
|
||||
* @param scene The node to be used as the starting point during the
|
||||
* rendering traversal of the scene graph.
|
||||
*/
|
||||
void setSceneData( osg::Node *scene );
|
||||
|
||||
/** Get the scene data being used for rendering.
|
||||
* @return The node being used as the starting point during the
|
||||
* rendering traversal of the scene graph.
|
||||
*/
|
||||
osg::Node *getSceneData() { return _scene_data.get(); }
|
||||
|
||||
const osg::Node *getSceneData() const { return _scene_data.get(); }
|
||||
|
||||
|
||||
|
||||
void setSceneDecorator( osg::Group* decorator);
|
||||
|
||||
osg::Group* getSceneDecorator() { return _scene_decorator.get(); }
|
||||
|
||||
const osg::Group* getSceneDecorator() const { return _scene_decorator.get(); }
|
||||
|
||||
|
||||
osg::Node* getTopMostSceneData();
|
||||
|
||||
const osg::Node* getTopMostSceneData() const;
|
||||
|
||||
|
||||
/** Update internal structures w.r.t updated scene data.*/
|
||||
virtual void updatedSceneData();
|
||||
|
||||
|
||||
void setDisplaySettings( osg::DisplaySettings *ds ) { _ds = ds; }
|
||||
|
||||
osg::DisplaySettings *getDisplaySettings() { return _ds.get(); }
|
||||
|
||||
const osg::DisplaySettings *getDisplaySettings() const { return _ds.get(); }
|
||||
|
||||
void setCullSettings( const osg::CullSettings& cs) { _cullSettings = cs; }
|
||||
|
||||
osg::CullSettings& getCullSettings() { return _cullSettings; }
|
||||
|
||||
const osg::CullSettings& getCullSettings() const { return _cullSettings; }
|
||||
|
||||
|
||||
|
||||
void setFrameStamp( osg::FrameStamp* fs );
|
||||
|
||||
osg::FrameStamp *getFrameStamp() { return _frameStamp.get(); }
|
||||
|
||||
const osg::FrameStamp *getFrameStamp() const { return _frameStamp.get(); }
|
||||
|
||||
|
||||
void setGlobalStateSet( osg::StateSet *sset );
|
||||
|
||||
osg::StateSet *getGlobalStateSet() { return _global_stateset.get(); }
|
||||
|
||||
const osg::StateSet *getGlobalStateSet() const { return _global_stateset.get(); }
|
||||
|
||||
|
||||
void setClearColor( const osg::Vec4& clearColor );
|
||||
|
||||
const osg::Vec4& getClearColor() const;
|
||||
|
||||
|
||||
void setLODScale( float scale );
|
||||
|
||||
float getLODScale() const;
|
||||
|
||||
void setFusionDistance( osgUtil::SceneView::FusionDistanceMode mode,float value=1.0f);
|
||||
|
||||
|
||||
/** Set the options to set up SceneView with, see osgUtil::SceneView::Options for available options.*/
|
||||
void setRealizeSceneViewOptions(unsigned int options) { _realizeSceneViewOptions = options; }
|
||||
|
||||
/** Get the options to set up SceneView with.*/
|
||||
unsigned int getRealizeSceneViewOptions() { return _realizeSceneViewOptions; }
|
||||
|
||||
/** Set whether processor affinity should be enable where supported by hardware.*/
|
||||
void setEnableProcessorAffinityHint(bool enableProccessAffinityHint) { _enableProccessAffinityHint = enableProccessAffinityHint; }
|
||||
|
||||
/** Get whether processor affinity should be enable where supported by hardware.*/
|
||||
bool getEnableProcessorAffinityHint() const { return _enableProccessAffinityHint; }
|
||||
|
||||
|
||||
/** RealizeCallback class one should override to provide an the implemention of realize callbacks.
|
||||
* Note, this callback overrides the normal call to OsgSceneHandler::init() so it become the your
|
||||
* responisibility to call this within your callback if required, it is a safe assumption to
|
||||
* always call OsgSceneHandler::init() within your callback..*/
|
||||
class OSGPRODUCER_EXPORT RealizeCallback : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
virtual void operator()( OsgCameraGroup& cg, OsgSceneHandler& sh, const Producer::RenderSurface & rs) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~RealizeCallback(); // {}
|
||||
};
|
||||
|
||||
/** Set the realize callback to use when once the render surfaces are realized.*/
|
||||
void setRealizeCallback( RealizeCallback* cb) { _realizeCallback = cb; }
|
||||
|
||||
/** Get the realize callback.*/
|
||||
RealizeCallback* getRealizeCallback() { return _realizeCallback.get(); }
|
||||
|
||||
/** Get the const realize callback.*/
|
||||
const RealizeCallback* getRealizeCallback() const { return _realizeCallback.get(); }
|
||||
|
||||
|
||||
void advance();
|
||||
|
||||
/** Set the threading model and then call realize().*/
|
||||
virtual bool realize(ThreadingModel thread_model );
|
||||
|
||||
/** Realize the render surfaces (OpenGL graphics) and various threads, and call any realize callbacks.*/
|
||||
virtual bool realize();
|
||||
|
||||
/** Set the model view matrix of the camera group,
|
||||
* by individually set all the camera groups's camera.*/
|
||||
virtual void setView(const osg::Matrixd& matrix);
|
||||
|
||||
/** Get the model view martrix of the camera group,
|
||||
* taking its value for camera 0.*/
|
||||
osg::Matrixd getViewMatrix() const;
|
||||
|
||||
|
||||
virtual void sync();
|
||||
|
||||
/** Dispatch the cull and draw for each of the Camera's for this frame.*/
|
||||
virtual void frame();
|
||||
|
||||
|
||||
/** Dispatch a clean up frame that should be called before closing a OsgCameraGroup, i.e. on exit from an app.
|
||||
* The clean up frame first release all GL objects associated with all the graphics context associated with
|
||||
* the camera group, then runs a special frame that does the actual OpenGL deletion of GL objects for each
|
||||
* graphics context. */
|
||||
virtual void cleanup_frame();
|
||||
|
||||
|
||||
protected :
|
||||
|
||||
|
||||
virtual void setUpSceneViewsWithData();
|
||||
|
||||
|
||||
osg::ApplicationUsage* _applicationUsage;
|
||||
|
||||
osg::ref_ptr<osg::Node> _scene_data;
|
||||
osg::ref_ptr<osg::Group> _scene_decorator;
|
||||
|
||||
osg::ref_ptr<osg::StateSet> _global_stateset;
|
||||
osg::Vec4 _clear_color;
|
||||
|
||||
osgUtil::SceneView::FusionDistanceMode _fusionDistanceMode;
|
||||
float _fusionDistanceValue;
|
||||
|
||||
unsigned int _realizeSceneViewOptions;
|
||||
|
||||
GraphicsContextList _gcList;
|
||||
SceneHandlerList _shvec;
|
||||
|
||||
osg::ref_ptr<osg::View> _view;
|
||||
|
||||
osg::ref_ptr<RealizeCallback> _realizeCallback;
|
||||
|
||||
osg::ref_ptr<osg::DisplaySettings> _ds;
|
||||
bool _initialized;
|
||||
|
||||
osg::CullSettings _cullSettings;
|
||||
|
||||
unsigned int _frameNumber;
|
||||
osg::Timer _timer;
|
||||
osg::Timer_t _start_tick;
|
||||
osg::ref_ptr<osg::FrameStamp> _frameStamp;
|
||||
|
||||
bool _enableProccessAffinityHint;
|
||||
|
||||
void _init();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,148 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGPRODUCER_OSGSCENEHANDLER
|
||||
#define OSGPRODUCER_OSGSCENEHANDLER 1
|
||||
|
||||
#include <osg/Timer>
|
||||
#include <osgUtil/SceneView>
|
||||
#include <osgUtil/Statistics>
|
||||
|
||||
#include <Producer/Camera>
|
||||
|
||||
#include <osgProducer/Export>
|
||||
|
||||
|
||||
|
||||
namespace osgProducer {
|
||||
|
||||
class OSGPRODUCER_EXPORT OsgSceneHandler : public Producer::Camera::SceneHandler
|
||||
{
|
||||
public :
|
||||
|
||||
OsgSceneHandler(osg::DisplaySettings *ds = NULL);
|
||||
|
||||
/// set the scene view to which will manage rendering of the OSG scene.
|
||||
void setSceneView(osgUtil::SceneView* sceneView) { _sceneView = sceneView; }
|
||||
|
||||
/// get the scene view.
|
||||
osgUtil::SceneView* getSceneView() { return _sceneView.get(); }
|
||||
|
||||
/// get the const scene view.
|
||||
const osgUtil::SceneView* getSceneView() const { return _sceneView.get(); }
|
||||
|
||||
/// override the init method to force it be run one at a time.
|
||||
virtual void init();
|
||||
|
||||
|
||||
class Callback : public osg::Referenced
|
||||
{
|
||||
public:
|
||||
virtual ~Callback() {}
|
||||
virtual void operator()(OsgSceneHandler&, Producer::Camera &) = 0;
|
||||
};
|
||||
|
||||
virtual void clear(Producer::Camera& camera)
|
||||
{
|
||||
if (_clearCallback.valid()) (*_clearCallback)(*this,camera);
|
||||
else clearImplementation(camera);
|
||||
}
|
||||
|
||||
virtual void clearImplementation(Producer::Camera& camera);
|
||||
|
||||
void setClearCallback(Callback* callback) { _clearCallback = callback; }
|
||||
Callback* getClearCallback() { return _clearCallback.get(); }
|
||||
const Callback* getClearCallback() const { return _clearCallback.get(); }
|
||||
|
||||
|
||||
virtual void cull(Producer::Camera& camera)
|
||||
{
|
||||
if (_cullCallback.valid()) (*_cullCallback)(*this,camera);
|
||||
else cullImplementation(camera);
|
||||
}
|
||||
|
||||
virtual void cullImplementation(Producer::Camera& camera);
|
||||
|
||||
void setCullCallback(Callback* callback) { _cullCallback = callback; }
|
||||
Callback* getCullCallback() { return _cullCallback.get(); }
|
||||
const Callback* getCullCallback() const { return _cullCallback.get(); }
|
||||
|
||||
virtual void draw(Producer::Camera& camera)
|
||||
{
|
||||
if (_cleanUpOnNextFrame)
|
||||
{
|
||||
_sceneView->flushAllDeletedGLObjects();
|
||||
_flushOfAllDeletedGLObjectsOnNextFrame = false;
|
||||
_cleanUpOnNextFrame = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_flushOfAllDeletedGLObjectsOnNextFrame && _sceneView.valid())
|
||||
{
|
||||
_sceneView->flushAllDeletedGLObjects();
|
||||
}
|
||||
|
||||
if (_drawCallback.valid()) (*_drawCallback)(*this,camera);
|
||||
else drawImplementation(camera);
|
||||
|
||||
_flushOfAllDeletedGLObjectsOnNextFrame = false;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void drawImplementation(Producer::Camera& camera);
|
||||
|
||||
void setDrawCallback(Callback* callback) { _drawCallback = callback; }
|
||||
Callback* getDrawCallback() { return _drawCallback.get(); }
|
||||
const Callback* getDrawCallback() const { return _drawCallback.get(); }
|
||||
|
||||
void setCollectStats(bool collectStats) { _collectStats = collectStats; }
|
||||
bool getCollectStats() const { return _collectStats; }
|
||||
|
||||
bool getStats(osgUtil::Statistics& primStats);
|
||||
|
||||
void setContextID( int id );
|
||||
|
||||
void setFlushOfAllDeletedGLObjectsOnNextFrame(bool flag) { _flushOfAllDeletedGLObjectsOnNextFrame = flag; }
|
||||
|
||||
bool getFlushOfAllDeletedGLObjectsOnNextFrame() const { return _flushOfAllDeletedGLObjectsOnNextFrame; }
|
||||
|
||||
void setCleanUpOnNextFrame(bool flag) { _cleanUpOnNextFrame = flag; }
|
||||
|
||||
bool getCleanUpOnNextFrame() const { return _cleanUpOnNextFrame; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~OsgSceneHandler() {}
|
||||
|
||||
|
||||
OpenThreads::Mutex _cullMutex;
|
||||
|
||||
osg::ref_ptr<osgUtil::SceneView> _sceneView;
|
||||
|
||||
osg::ref_ptr<Callback> _clearCallback;
|
||||
osg::ref_ptr<Callback> _cullCallback;
|
||||
osg::ref_ptr<Callback> _drawCallback;
|
||||
|
||||
osg::Timer_t _frameStartTick;
|
||||
osg::Timer_t _previousFrameStartTick;
|
||||
|
||||
bool _flushOfAllDeletedGLObjectsOnNextFrame;
|
||||
bool _cleanUpOnNextFrame;
|
||||
|
||||
bool _collectStats;
|
||||
osgUtil::Statistics _stats;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,48 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGPRODUCER_VERSION
|
||||
#define OSGPRODUCER_VERSION 1
|
||||
|
||||
#include <osgProducer/Export>
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
/**
|
||||
* osgProducerGetVersion() returns the library version number.
|
||||
* Numbering convention : OpenSceneGraph-1.0 will return 1.0 from osgProducerGetVersion.
|
||||
*
|
||||
* This C function can be also used to check for the existence of the OpenSceneGraph
|
||||
* library using autoconf and its m4 macro AC_CHECK_LIB.
|
||||
*
|
||||
* Here is the code to add to your configure.in:
|
||||
\verbatim
|
||||
#
|
||||
# Check for the OpenSceneGraph (OSG) GLUT library
|
||||
#
|
||||
AC_CHECK_LIB(osg, osgProducerGetVersion, ,
|
||||
[AC_MSG_ERROR(OpenSceneGraph GLUT library not found. See http://www.openscenegraph.org)],)
|
||||
\endverbatim
|
||||
*/
|
||||
extern OSGPRODUCER_EXPORT const char* osgProducerGetVersion();
|
||||
|
||||
/**
|
||||
* getLibraryName_osgProducer() returns the library name in human friendly form.
|
||||
*/
|
||||
extern OSGPRODUCER_EXPORT const char* osgProducerGetLibraryName();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,356 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGPRODUCER_VIEWER
|
||||
#define OSGPRODUCER_VIEWER 1
|
||||
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osg/ArgumentParser>
|
||||
#include <osg/ApplicationUsage>
|
||||
#include <osg/AnimationPath>
|
||||
#include <osg/observer_ptr>
|
||||
|
||||
#include <osgUtil/IntersectVisitor>
|
||||
|
||||
#include <osgGA/GUIActionAdapter>
|
||||
#include <osgGA/GUIEventHandler>
|
||||
#include <osgGA/EventVisitor>
|
||||
#include <osgGA/KeySwitchMatrixManipulator>
|
||||
|
||||
#include <osgProducer/OsgCameraGroup>
|
||||
#include <osgProducer/KeyboardMouseCallback>
|
||||
|
||||
#include <list>
|
||||
|
||||
namespace osgProducer {
|
||||
|
||||
/** A Producer-based viewer. Just like OpenGL, the core of OSG is independent of
|
||||
* windowing system. The integration between OSG and some windowing system is
|
||||
* delegated to other, non-core parts of OSG (users are also allowed to
|
||||
* integrate OSG with any exotic windowing system they happen to use).
|
||||
* \c Viewer implements the integration between OSG and Producer, AKA Open
|
||||
* Producer (http://www.andesengineering.com/Producer), thus offering an
|
||||
* out-of-the-box, scalable and multi-platform abstraction of the windowing
|
||||
* system.
|
||||
*/
|
||||
class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIActionAdapter
|
||||
{
|
||||
public :
|
||||
|
||||
Viewer();
|
||||
|
||||
Viewer(Producer::CameraConfig *cfg);
|
||||
|
||||
Viewer(const std::string& configFile);
|
||||
|
||||
Viewer(osg::ArgumentParser& arguments);
|
||||
|
||||
virtual ~Viewer();
|
||||
|
||||
/** Specifies options to control some aspects of the
|
||||
* \c Viewer behavior (using the \c setUpViewer() member
|
||||
* function).
|
||||
*/
|
||||
enum ViewerOptions
|
||||
{
|
||||
/** Do not activate any standard event handlers.
|
||||
* If no event handlers are selected then the users would typically
|
||||
* register their own custom event handlers to add user interaction via
|
||||
* getEventHandlerList().push_back(myEventHandler) or addCameraManipulator(myCameraManipualtor).*/
|
||||
NO_EVENT_HANDLERS = 0,
|
||||
|
||||
/** Add an \c osgGA::TrackballManipulator to manipulate the camera
|
||||
* interactively.
|
||||
*/
|
||||
TRACKBALL_MANIPULATOR = 1,
|
||||
|
||||
/** Add an \c osgGA::DriveManipulator to manipulate the camera
|
||||
* interactively.
|
||||
*/
|
||||
DRIVE_MANIPULATOR = 2,
|
||||
|
||||
/** Add an \c osgGA::FlightManipulator to manipulate the camera
|
||||
* interactively.
|
||||
*/
|
||||
FLIGHT_MANIPULATOR = 4,
|
||||
|
||||
/** Add an \c osgGA::TerrainManipulator to manipulate the camera
|
||||
* interactively.
|
||||
*/
|
||||
TERRAIN_MANIPULATOR = 8,
|
||||
|
||||
/** Add an \c osgGA::UFOManipulator to manipulate the camera
|
||||
* interactively.
|
||||
*/
|
||||
UFO_MANIPULATOR = 0x10,
|
||||
|
||||
/** Add an \c osgGA::StateSetManipulator to interactively toggle
|
||||
* some bits of the renderer state (texturing, lightning...)
|
||||
*/
|
||||
STATE_MANIPULATOR = 32,
|
||||
|
||||
/** Add a light source some point near the camera. */
|
||||
HEAD_LIGHT_SOURCE = 64,
|
||||
|
||||
/** Add a light source above the scene; does nothing if
|
||||
* \c HEAD_LIGHT_SOURCE is also used.
|
||||
*/
|
||||
SKY_LIGHT_SOURCE = 128,
|
||||
|
||||
/** Add peformance statistics reporting, currently implemented via VIEWER_MANPULATOR. */
|
||||
STATS_MANIPULATOR = 256,
|
||||
|
||||
/** Add an \c osgProducer::ViewerEventHandler that enables lots of
|
||||
* tricks like performance statistics and writing the scene to a
|
||||
* file.
|
||||
*/
|
||||
VIEWER_MANIPULATOR = 512,
|
||||
|
||||
/** Finish the viewer execution when the ESC key is pressed. */
|
||||
ESCAPE_SETS_DONE = 1024,
|
||||
|
||||
/** Enable a set of standard settings (\c TRACKBALL_MANIPULATOR,
|
||||
* \c DRIVE_MANIPULATOR, \c FLIGHT_MANIPULATOR,
|
||||
* \c TERRAIN_MANIPULATOR, \c STATE_MANIPULATOR,
|
||||
* \c HEAD_LIGHT_SOURCE, \c STATS_MANIPULATOR,
|
||||
* \c VIEWER_MANIPULATOR, \c ESCAPE_SETS_DONE).
|
||||
*/
|
||||
STANDARD_SETTINGS = TRACKBALL_MANIPULATOR|
|
||||
DRIVE_MANIPULATOR |
|
||||
FLIGHT_MANIPULATOR |
|
||||
TERRAIN_MANIPULATOR |
|
||||
UFO_MANIPULATOR |
|
||||
STATE_MANIPULATOR |
|
||||
HEAD_LIGHT_SOURCE |
|
||||
STATS_MANIPULATOR |
|
||||
VIEWER_MANIPULATOR |
|
||||
ESCAPE_SETS_DONE
|
||||
};
|
||||
|
||||
/** Set up the viewer, allowing to control some aspects of its behavior.
|
||||
* @param options One or more of the options defined by the
|
||||
* \c ViewerOptions enumeration, combined using the bitwise OR
|
||||
* operator (``<tt>|</tt>'').
|
||||
*/
|
||||
void setUpViewer(unsigned int options=STANDARD_SETTINGS);
|
||||
|
||||
/** Set the viewer so it sets done to true once the refrence time equals or exceeds specified elapsed time.
|
||||
* Automatically does a setDoneAtElapsedTimeEnabled(true). */
|
||||
void setDoneAtElapsedTime(double elapsedTime) { _setDoneAtElapsedTimeEnabled = true; _setDoneAtElapsedTime = elapsedTime; }
|
||||
|
||||
/** Get the elapsed time that will cause done to be set to be true.*/
|
||||
double getDoneAtElapsedTime() const { return _setDoneAtElapsedTime; }
|
||||
|
||||
/** Set whether to use a elapsed time to limit the run of the viewer.*/
|
||||
void setDoneAtElapsedTimeEnabled(bool enabled) { _setDoneAtElapsedTimeEnabled = enabled; }
|
||||
|
||||
/** Get whether to use a elapsed time to limit the run of the viewer.*/
|
||||
bool getDoneAtElapsedTimeEnabled() const { return _setDoneAtElapsedTimeEnabled; }
|
||||
|
||||
/** Set the viewer so it sets done to true once the frame number equals or exceeds specified frame number.
|
||||
* Automatically does a setDoneAtFrameNumberEnabled(true). */
|
||||
void setDoneAtFrameNumber(unsigned int frameNumber) { _setDoneAtFrameNumberEnabled = true; _setDoneAtFrameNumber = frameNumber; }
|
||||
|
||||
/** Get the frame number that will cause done to be set to be true.*/
|
||||
unsigned int getDoneAtFrameNumber() const { return _setDoneAtFrameNumber; }
|
||||
|
||||
/** Set whether to use a frame number to limit the run of the viewer.*/
|
||||
void setDoneAtFrameNumberEnabled(bool enabled) { _setDoneAtFrameNumberEnabled = enabled; }
|
||||
|
||||
/** Get whether to use a frame number to limit the run of the viewer.*/
|
||||
bool getDoneAtFrameNumberEnabled() const { return _setDoneAtFrameNumberEnabled; }
|
||||
|
||||
/** Set the done flag signalling that the viewer exit.*/
|
||||
void setDone(bool done) { _done = done; }
|
||||
|
||||
/** Get the done flag which signals that the viewer exit.*/
|
||||
bool getDone() const { return _done; }
|
||||
|
||||
/** Return true if the application is done and should exit.*/
|
||||
virtual bool done() const;
|
||||
|
||||
/** Set the viewer to take an image snapshot on the last frame() when done is enabled.*/
|
||||
void setWriteImageWhenDone(bool enabled) { _writeImageWhenDone = enabled; }
|
||||
|
||||
/** Set the viewer to take an image snapshot on the last frame() when done is enabled.*/
|
||||
bool getWriteImageWhenDone() const { return _writeImageWhenDone; }
|
||||
|
||||
/** Set the filename to write to when the viewer takes an image snapshot on the last frame() when done is enabled.*/
|
||||
void setWriteImageFileName(const std::string& filename);
|
||||
|
||||
/** Get the filename to write to when the viewer takes an image snapshot on the last frame() when done is enabled.*/
|
||||
const std::string& getWriteImageFileName() const;
|
||||
|
||||
/** Get the default filename for writing an image snapshot */
|
||||
static const char* getDefaultImageFileName();
|
||||
|
||||
|
||||
/** Override the Producer::CameraGroup::setViewByMatrix to catch all changes to view.*/
|
||||
virtual void setViewByMatrix( const Producer::Matrix & pm);
|
||||
|
||||
/** Set the threading model and then call realize().*/
|
||||
virtual bool realize(ThreadingModel thread_model);
|
||||
|
||||
virtual bool realize();
|
||||
|
||||
/** Updated the scene. Handle any queued up events, do an update traversal and set the CameraGroup's setViewByMatrix if any camera manipulators are active.*/
|
||||
virtual void update();
|
||||
|
||||
/** Set the update visitor which does the update traversal of the scene graph. Automatically called by the update() method.*/
|
||||
void setUpdateVisitor(osg::NodeVisitor* nv) { _updateVisitor = nv; }
|
||||
|
||||
/** Get the update visitor.*/
|
||||
osg::NodeVisitor* getUpdateVisitor() { return _updateVisitor.get(); }
|
||||
|
||||
/** Get the const update visitor.*/
|
||||
const osg::NodeVisitor* getUpdateVisitor() const { return _updateVisitor.get(); }
|
||||
|
||||
|
||||
/** Set the update visitor which does the event traversal of the scene graph. Automatically called by the update() method.*/
|
||||
void setEventVisitor(osgGA::EventVisitor* nv) { _eventVisitor = nv; }
|
||||
|
||||
/** Get the update visitor.*/
|
||||
osgGA::EventVisitor* getEventVisitor() { return _eventVisitor.get(); }
|
||||
|
||||
/** Get the const update visitor.*/
|
||||
const osgGA::EventVisitor* getEventVisitor() const { return _eventVisitor.get(); }
|
||||
|
||||
|
||||
void computeActiveCoordinateSystemNodePath();
|
||||
|
||||
void setCoordinateSystemNodePath(const osg::NodePath& nodePath);
|
||||
|
||||
osg::NodePath getCoordinateSystemNodePath() const;
|
||||
|
||||
/** Dispatch the cull and draw for each of the Camera's for this frame.*/
|
||||
virtual void frame();
|
||||
|
||||
virtual void requestRedraw();
|
||||
virtual void requestContinuousUpdate(bool);
|
||||
virtual void requestWarpPointer(float x,float y);
|
||||
|
||||
|
||||
/** Compute, from normalized mouse coords, for sepecified Camera, the pixel coords relative to that Camera's RenderSurface.*/
|
||||
bool computePixelCoords(float x,float y,unsigned int cameraNum,float& pixel_x,float& pixel_y);
|
||||
|
||||
/** Compute, from normalized mouse coords, for sepecified Camera, the near and far points in worlds coords.*/
|
||||
bool computeNearFarPoints(float x,float y,unsigned int cameraNum,osg::Vec3& near, osg::Vec3& far);
|
||||
|
||||
/** Compute, from normalized mouse coords, for all Cameras, intersections with the specified subgraph.*/
|
||||
bool computeIntersections(float x,float y,unsigned int cameraNum,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask = 0xffffffff);
|
||||
|
||||
/** Compute, from normalized mouse coords, for sepecified Camera, intersections with the scene.*/
|
||||
bool computeIntersections(float x,float y,unsigned int cameraNum,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask = 0xffffffff);
|
||||
|
||||
/** Compute, from normalized mouse coords, for all Cameras, intersections with specified subgraph.*/
|
||||
bool computeIntersections(float x,float y,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask = 0xffffffff);
|
||||
|
||||
/** Compute, from normalized mouse coords, for all Cameras, intersections with the scene.*/
|
||||
bool computeIntersections(float x,float y,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask = 0xffffffff);
|
||||
|
||||
/** Set the EventQueue - a thread safe queue for registering events.*/
|
||||
void setEventQueue(osgGA::EventQueue* eventQueue) { _eventQueue = eventQueue; }
|
||||
|
||||
/** Get the EventQueue.*/
|
||||
osgGA::EventQueue* getEventQueue() { return _eventQueue.get(); }
|
||||
|
||||
void setKeyboardMouse(Producer::KeyboardMouse* kbm);
|
||||
Producer::KeyboardMouse* getKeyboardMouse() { return _kbm.get(); }
|
||||
const Producer::KeyboardMouse* getKeyboardMouse() const { return _kbm.get(); }
|
||||
|
||||
void setKeyboardMouseCallback(osgProducer::KeyboardMouseCallback* kbmcb);
|
||||
osgProducer::KeyboardMouseCallback* getKeyboardMouseCallback() { return _kbmcb.get(); }
|
||||
const osgProducer::KeyboardMouseCallback* getKeyboardMouseCallback() const { return _kbmcb.get(); }
|
||||
|
||||
typedef std::list< osg::ref_ptr<osgGA::GUIEventHandler> > EventHandlerList;
|
||||
EventHandlerList& getEventHandlerList() { return _eventHandlerList; }
|
||||
const EventHandlerList& getEventHandlerList() const { return _eventHandlerList; }
|
||||
|
||||
osgGA::KeySwitchMatrixManipulator* getKeySwitchMatrixManipulator() { return _keyswitchManipulator.get(); }
|
||||
const osgGA::KeySwitchMatrixManipulator* getKeySwitchMatrixManipulator() const { return _keyswitchManipulator.get(); }
|
||||
|
||||
unsigned int addCameraManipulator(osgGA::MatrixManipulator* cm);
|
||||
void selectCameraManipulator(unsigned int no);
|
||||
void getCameraManipulatorNameList( std::list<std::string> &nameList );
|
||||
bool selectCameraManipulatorByName( const std::string &name );
|
||||
osgGA::MatrixManipulator *getCameraManipulatorByName( const std::string &name );
|
||||
|
||||
|
||||
void setRecordingAnimationPath(bool on) { _recordingAnimationPath = on; }
|
||||
bool getRecordingAnimationPath() const { return _recordingAnimationPath; }
|
||||
|
||||
void setAnimationPath(osg::AnimationPath* path) { _animationPath = path; }
|
||||
osg::AnimationPath* getAnimationPath() { return _animationPath.get(); }
|
||||
const osg::AnimationPath* getAnimationPath() const { return _animationPath.get(); }
|
||||
|
||||
|
||||
const double* getPosition() const { return _position; }
|
||||
double getSpeed() const { return _speed; }
|
||||
osg::Quat getOrientation() const { return _orientation; }
|
||||
|
||||
|
||||
/** Get the keyboard and mouse usage of this viewer.*/
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
/** Update internal structures w.r.t updated scene data.*/
|
||||
virtual void updatedSceneData();
|
||||
|
||||
/** Dispatch a clean up frame that should be called before closing a OsgCameraGroup, i.e. on exit from an app.
|
||||
* The clean up frame first release all GL objects associated with all the graphics context associated with
|
||||
* the camera group, then runs a special frame that does the actual OpenGL deletion of GL objects for each
|
||||
* graphics context. */
|
||||
virtual void cleanup_frame();
|
||||
|
||||
protected :
|
||||
|
||||
|
||||
bool _setDoneAtElapsedTimeEnabled;
|
||||
double _setDoneAtElapsedTime;
|
||||
|
||||
bool _setDoneAtFrameNumberEnabled;
|
||||
unsigned int _setDoneAtFrameNumber;
|
||||
|
||||
bool _done;
|
||||
|
||||
bool _writeImageWhenDone;
|
||||
std::string _writeImageFileName;
|
||||
|
||||
osg::ref_ptr<osgGA::EventQueue> _eventQueue;
|
||||
|
||||
osg::ref_ptr<Producer::KeyboardMouse> _kbm;
|
||||
|
||||
osg::ref_ptr<osgProducer::KeyboardMouseCallback> _kbmcb;
|
||||
|
||||
EventHandlerList _eventHandlerList;
|
||||
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> _keyswitchManipulator;
|
||||
|
||||
osg::ref_ptr<osg::NodeVisitor> _updateVisitor;
|
||||
osg::ref_ptr<osgGA::EventVisitor> _eventVisitor;
|
||||
|
||||
|
||||
typedef std::vector< osg::observer_ptr<osg::Node> > ObserveredNodePath;
|
||||
ObserveredNodePath _coordinateSystemNodePath;
|
||||
|
||||
bool _recordingAnimationPath;
|
||||
double _recordingStartTime;
|
||||
osg::ref_ptr<osg::AnimationPath> _animationPath;
|
||||
|
||||
// record the current position and orientation of the view.
|
||||
double _position[3];
|
||||
osg::Quat _orientation;
|
||||
double _speed;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,89 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGPRODUCER_VIEWEREVENTHANDLER
|
||||
#define OSGPRODUCER_VIEWEREVENTHANDLER 1
|
||||
|
||||
#include <osgGA/GUIEventHandler>
|
||||
#include <osgProducer/Viewer>
|
||||
|
||||
namespace osgProducer {
|
||||
|
||||
class OSGPRODUCER_EXPORT ViewerEventHandler : public osgGA::GUIEventHandler
|
||||
{
|
||||
public:
|
||||
|
||||
ViewerEventHandler(OsgCameraGroup* cg);
|
||||
|
||||
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa);
|
||||
|
||||
/** Get the keyboard and mouse usage of this manipulator.*/
|
||||
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
||||
|
||||
OsgCameraGroup* getOsgCameraGroup() { return _cg; }
|
||||
const OsgCameraGroup* getOsgCameraGroup() const { return _cg; }
|
||||
|
||||
|
||||
void setWriteNodeFileName(const std::string& filename) { _writeNodeFileName = filename; }
|
||||
const std::string& getWriteNodeFileName() const { return _writeNodeFileName; }
|
||||
|
||||
|
||||
void setDisplayHelp(bool displayHelp) { _displayHelp = displayHelp; }
|
||||
|
||||
bool getDisplayHelp() const { return _displayHelp; }
|
||||
|
||||
|
||||
enum FrameStatsMode
|
||||
{
|
||||
NO_STATS = 0,
|
||||
FRAME_RATE = 1,
|
||||
CAMERA_STATS = 2,
|
||||
SCENE_STATS = 3
|
||||
};
|
||||
|
||||
void setFrameStatsMode(FrameStatsMode mode);
|
||||
FrameStatsMode getFrameStatsMode() { return _frameStatsMode; }
|
||||
|
||||
void setWriteImageOnNextFrame(bool writeImageOnNextFrame);
|
||||
|
||||
void setWriteImageFileName(const std::string& filename);
|
||||
const std::string& getWriteImageFileName() const { return _writeImageFileName; }
|
||||
|
||||
/** release OpenGL objects in specified graphics context if State
|
||||
object is passed, otherwise release OpenGL objexts for all graphics context if
|
||||
State object pointer NULL.*/
|
||||
virtual void releaseGLObjects(osg::State* =0) const;
|
||||
|
||||
protected:
|
||||
|
||||
osgProducer::OsgCameraGroup* _cg;
|
||||
|
||||
std::string _writeNodeFileName;
|
||||
|
||||
bool _displayHelp;
|
||||
FrameStatsMode _frameStatsMode;
|
||||
|
||||
bool _firstTimeTogglingFullScreen;
|
||||
|
||||
class StatsAndHelpDrawCallback;
|
||||
StatsAndHelpDrawCallback* _statsAndHelpDrawCallback;
|
||||
|
||||
class SnapImageDrawCallback;
|
||||
typedef std::vector<SnapImageDrawCallback*> SnapImageDrawCallbackList;
|
||||
SnapImageDrawCallbackList _snapImageDrawCallbackList;
|
||||
std::string _writeImageFileName;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -28,10 +28,8 @@
|
||||
namespace osgUtil {
|
||||
|
||||
/**
|
||||
* SceneView is literaly a view of a scene, encapsulating the 'camera'
|
||||
* (not to be confused with Producer::Camera) (modelview+projection matrices),
|
||||
* global state, lights and the scene itself. Provides
|
||||
* methods for setting up the view and rendering it.
|
||||
* SceneView is literaly a view of a scene, encapsulating the rendering of the scene.
|
||||
* Provides methods for setting up the view and rendering it.
|
||||
*/
|
||||
class OSGUTIL_EXPORT SceneView : public osg::Object, public osg::CullSettings
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user