17#ifndef AGXOSG_IMAGECAPTURE_H
18#define AGXOSG_IMAGECAPTURE_H
25#include <osg/observer_ptr>
89 virtual void apply( osg::RenderInfo& renderInfo );
103 typedef std::queue<std::pair<osg::ref_ptr<osg::Image>,
agx::Index> > ImageVectorT;
112 bool m_captureEnabled;
120 osg::ref_ptr<DrawCallback> m_drawCallback;
178 std::string m_prefix;
179 std::string m_postfix;
180 std::string m_directory;
189 void push(ImageVectorT::value_type image_set)
192 ImageVectorT::push(image_set);
199 return ImageVectorT::size();
205 while(ImageVectorT::size())
243 void push(ImageVectorT::value_type image_set);
249 ImageVectorT::value_type topAndPop();
254 std::atomic<bool> m_stop;
264 virtual void operator () (osg::RenderInfo& renderInfo)
const;
265 using osg::Camera::DrawCallback::operator();
#define AGX_DECLARE_POINTER_TYPES(type)
void push(ImageVectorT::value_type image_set)
WriteImageThread(ImageCaptureBase *cap)
virtual void run()
This method is invoked by start.
void push(ImageVectorT::value_type image_set)
virtual ~WriteImageThread()
agxSDK::Simulation * getSimulation()
virtual bool stopCapture()
Return false if stopping an already stopped capture process.
virtual void writeImage(osg::Image *image, agx::Index index)=0
agx::Vec2u getImageResolution() const
bool getEnableSyncWithSimulation() const
void setFps(agx::Real fps)
Set the desired frame rate (rate of capture).
DrawCallback(ImageCaptureBase *capture)
ImageCaptureBase * getImageCapture()
void setImageCapture(ImageCaptureBase *ic)
virtual void apply(osg::RenderInfo &renderInfo)
virtual ~ImageCaptureBase()
virtual void startCapture(int startImageNumber=0)
Enable/disable capturing.
DrawCallback * getDrawCallback()
agx::Real getFps()
Return the specified desired frame rate for capture.
void setEnableSyncWithSimulation(bool enableSync)
void setCaptureStarted(bool f)
void setSimulation(agxSDK::Simulation *simulation)
ImageCaptureBase(agxSDK::Simulation *sim=nullptr)
void setImageResolution(agx::UInt width, agx::UInt height)
void setMaxImages(int i)
Set a limit of the maximum number of images that should be captured Set -1 for no limit.
bool getCaptureStarted() const
Return whether the capturing is enabled or not.
ImageCapture(agxSDK::Simulation *sim=nullptr)
void setPostfix(const std::string &postfix)
Sets the postfix.
void setPrefix(const std::string &prefix)
std::string getPrefix() const
void setDirectoryPath(const std::string &path)
std::string getDirectoryPath() const
virtual void writeImage(osg::Image *image, agx::Index index)
std::string getPostfix() const
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Basic wrapper class aroud std::thread.
Block synchronization primitive.
void reset()
Reset the block.
void release()
Release the block.
void block()
Block until released from another thread.
Base class providing referencing counted objects.
The Timer class permits timing execution speed with the same refinement as the built in hardware cloc...
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
std::lock_guard< T > ScopeLock
agx::ScopeLock is an alias for std::lock_guard
std::recursive_mutex ReentrantMutex