15 #include <vsg/app/CompileManager.h>
16 #include <vsg/app/Presentation.h>
17 #include <vsg/app/RecordAndSubmitTask.h>
18 #include <vsg/app/UpdateOperations.h>
19 #include <vsg/app/Window.h>
20 #include <vsg/threading/Barrier.h>
21 #include <vsg/threading/FrameBlock.h>
44 Windows& windows() {
return _windows; }
45 const Windows& windows()
const {
return _windows; }
47 clock::time_point& start_point() {
return _start_point; }
48 const clock::time_point& start_point()
const {
return _start_point; }
50 FrameStamp* getFrameStamp() {
return _frameStamp; }
51 const FrameStamp* getFrameStamp()
const {
return _frameStamp; }
60 virtual bool pollEvents(
bool discardPreviousEvents =
true);
66 const UIEvents&
getEvents()
const {
return _events; }
71 void addEventHandlers(
const EventHandlers& eventHandlers) { _eventHandlers.insert(_eventHandlers.end(), eventHandlers.begin(), eventHandlers.end()); }
85 updateOperations->add(op, runBehavior);
101 virtual bool acquireNextFrame();
105 virtual VkResult
waitForFences(
size_t relativeFrameIndex, uint64_t timeout);
108 RecordAndSubmitTasks recordAndSubmitTasks;
111 using Presentations = std::vector<ref_ptr<Presentation>>;
112 Presentations presentations;
122 std::list<std::thread> threads;
124 void setupThreading();
125 void stopThreading();
127 virtual void update();
129 virtual void recordAndSubmit();
131 virtual void present();
145 clock::time_point _start_point;
147 EventHandlers _eventHandlers;
149 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.
const EventHandlers & getEventHandlers() const
get the const list of EventHandlers
Definition: Viewer.h:77
void addRecordAndSubmitTaskAndPresentation(CommandGraphs commandGraphs)
Add command graphs creating RecordAndSubmitTask/Presentation objects where appropriate.
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:80
virtual void assignRecordAndSubmitTaskAndPresentation(CommandGraphs commandGraphs)
void addUpdateOperation(ref_ptr< Operation > op, UpdateOperations::RunBehavior runBehavior=UpdateOperations::ONE_TIME)
add an update operation
Definition: Viewer.h:83
void addEventHandler(ref_ptr< Visitor > eventHandler)
add event handler
Definition: Viewer.h:69
bool active() const
return true if viewer is valid and active
virtual bool advanceToNextFrame()
const UIEvents & getEvents() const
get the const current set of Events that are filled in by prior calls to pollEvents
Definition: Viewer.h:66
virtual bool pollEvents(bool discardPreviousEvents=true)
poll the events for all attached windows, return true if new events are available
virtual void close()
schedule closure of the viewer and associated windows, after a call to Viewer::close() the Viewer::ac...
UIEvents & getEvents()
get the current set of Events that are filled in by prior calls to pollEvents
Definition: Viewer.h:63
virtual void removeWindow(ref_ptr< Window > window)
remove Window from Viewer
EventHandlers & getEventHandlers()
get the list of EventHandlers
Definition: Viewer.h:74
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:89
Definition: CompileManager.h:24