15#include <vsg/animation/AnimationManager.h>
16#include <vsg/app/CompileManager.h>
17#include <vsg/app/Presentation.h>
18#include <vsg/app/RecordAndSubmitTask.h>
19#include <vsg/app/UpdateOperations.h>
20#include <vsg/app/Window.h>
21#include <vsg/threading/Barrier.h>
22#include <vsg/threading/FrameBlock.h>
23#include <vsg/utils/Instrumentation.h>
46 Windows& windows() {
return _windows; }
47 const Windows& windows()
const {
return _windows; }
49 clock::time_point& start_point() {
return _start_point; }
50 const clock::time_point& start_point()
const {
return _start_point; }
52 FrameStamp* getFrameStamp() {
return _frameStamp; }
53 const FrameStamp* getFrameStamp()
const {
return _frameStamp; }
62 virtual bool pollEvents(
bool discardPreviousEvents =
true);
68 const UIEvents&
getEvents()
const {
return _events; }
73 void addEventHandlers(
const EventHandlers& eventHandlers) { _eventHandlers.insert(_eventHandlers.end(), eventHandlers.begin(), eventHandlers.end()); }
87 updateOperations->add(op, runBehavior);
97 static constexpr double UseTimeSinceStartPoint = std::numeric_limits<double>::max();
109 virtual bool acquireNextFrame();
113 virtual VkResult
waitForFences(
size_t relativeFrameIndex, uint64_t timeout);
116 RecordAndSubmitTasks recordAndSubmitTasks;
119 using Presentations = std::vector<ref_ptr<Presentation>>;
120 Presentations presentations;
130 std::list<std::thread> threads;
132 void setupThreading();
133 void stopThreading();
135 virtual void update();
137 virtual void recordAndSubmit();
139 virtual void present();
145 uint64_t frameReference = 0;
160 clock::time_point _start_point;
162 EventHandlers _eventHandlers;
164 bool _threading =
false;
RunBehavior
specification of whether update operation should be invoked once or on all frames
Definition UpdateOperations.h:31
virtual void deviceWaitIdle() const
Call vkDeviceWaitIdle on all the devices associated with this Viewer.
virtual bool advanceToNextFrame(double simulationTime=UseTimeSinceStartPoint)
void addRecordAndSubmitTaskAndPresentation(CommandGraphs commandGraphs)
Add command graphs creating RecordAndSubmitTask/Presentation objects where appropriate.
void assignInstrumentation(ref_ptr< Instrumentation > in_instrumentation)
Convenience method for assigning Instrumentation to the viewer and any associated objects.
virtual void handleEvents()
pass the Events into any registered EventHandlers
virtual VkResult waitForFences(size_t relativeFrameIndex, uint64_t timeout)
ref_ptr< UpdateOperations > updateOperations
thread safe container for update operations
Definition Viewer.h:82
virtual void assignRecordAndSubmitTaskAndPresentation(CommandGraphs commandGraphs)
ref_ptr< AnimationManager > animationManager
manager for starting and running animations
Definition Viewer.h:91
void addUpdateOperation(ref_ptr< Operation > op, UpdateOperations::RunBehavior runBehavior=UpdateOperations::ONE_TIME)
add an update operation
Definition Viewer.h:85
void addEventHandler(ref_ptr< Visitor > eventHandler)
add event handler
Definition Viewer.h:71
bool active() const
return true if viewer is valid and active
virtual bool pollEvents(bool discardPreviousEvents=true)
poll the events for all attached windows, return true if new events are available
UIEvents & getEvents()
get the current set of Events that are filled in by prior calls to pollEvents
Definition Viewer.h:65
virtual void close()
schedule closure of the viewer and associated windows, after a call to Viewer::close() the Viewer::ac...
virtual void removeWindow(ref_ptr< Window > window)
remove Window from Viewer
const EventHandlers & getEventHandlers() const
get the const list of EventHandlers
Definition Viewer.h:79
EventHandlers & getEventHandlers()
get the list of EventHandlers
Definition Viewer.h:76
const UIEvents & getEvents() const
get the const current set of Events that are filled in by prior calls to pollEvents
Definition Viewer.h:68
virtual void addWindow(ref_ptr< Window > window)
add Window to Viewer
ref_ptr< CompileManager > compileManager
compile manager provides thread safe support for compiling subgraphs
Definition Viewer.h:94
Definition CompileManager.h:24