VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtMainThreadJobsManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <osg/OperationThread>
13 #include <osgUtil/IncrementalCompileOperation>
14 #include <osgUtil/SceneView>
15 
16 #include <tbb/atomic.h>
17 
19 
20 #include <vrvOsg/vrvOsg.h>
23 
24 namespace makVrv
25 {
26 
27 
40 
48 
79 
80  class DT_DLL_VRVOSG DtMainThreadJobsManager : public osg::Operation
81  {
82  public:
84 
86  virtual ~DtMainThreadJobsManager() { ; }
87 
89  virtual void operator () (osg::Object* obj);
90 
91  virtual void startUp();
92 
94  virtual void release();
95 
97  void setIco(osgUtil::IncrementalCompileOperation * ico);
98 
100  virtual void addPersistantJob(osg::Operation * job);
101 
103  virtual void removePersistantJob(osg::Operation * job);
104 
106  virtual void addTransientJob(osg::Operation * job);
107 
108  int getNumberOfTransientJobs() { return myNumberOfTransientJobs; }
109 
110  protected:
111 
113  virtual void runTransientJobs(osgUtil::SceneView * sceneView);
114 
115  std::vector<osg::ref_ptr<osg::Operation> > myRepeatedJobs;
116 
117  // transient jobs
118  tbb::atomic<int> myNumberOfTransientJobs;
119  std::vector<osg::ref_ptr<osg::Operation> > myTransientJobs;
120  std::vector<osg::ref_ptr<osg::Operation> > myNextFrameJobs;
121 
122  osgUtil::IncrementalCompileOperation * myIco;
124  OpenThreads::Condition myRunThreadWaitCond;
125  tbb::atomic<int> myKeepGoing;
126  osg::ref_ptr<osg::Operation> myCurrentJob;
127 
128  private:
129 
132 
133  };
134 
135 
136 
139  {
140  public:
143 
146  private:
151  public:
153  virtual DtMainThreadJobsManager* create() const;
154 
157  static DtMainThreadJobsManagerCreator& instance(DtDe& de);
158 
160  static const std::string& theClassName();
161 
162  protected:
164  };
165 };

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)