VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgModelPreloader.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 <string>
13 
15 #include <vrvCore/DtUniqueID.h>
16 
17 #include <vrvOsg/vrvOsg.h>
18 
19 #include <osg/Node>
20 
21 #include <boost/unordered_map.hpp>
22 
23 #include <boost/thread.hpp>
24 #include <tbb/atomic.h>
25 #include <tbb/task.h>
26 #ifdef WIN32
27 #include <winsock2.h>
28 #endif
29 #include <tbb/mutex.h>
30 
31 namespace osgUtil {
32  class StateToCompile;
33 }
34 
35 namespace osgViewer {
36  class CompositeViewer;
37 }
38 
39 namespace makVrv
40 {
41  class DtDe;
42  class DtModelDefinition;
46  {
47 
48  public:
49 
52 
54  virtual ~DtOsgModelPreloader();
55 
57  virtual bool load(const std::string& modelDefName);
58 
60  virtual void addToIcoList(osgUtil::StateToCompile* state);
61 
63  virtual std::list<osgUtil::StateToCompile* >& toIcoList();
64 
66  virtual void finishPreloading(osgViewer::CompositeViewer& viewer);
67 
69  static DtOsgModelPreloader* preloader();
70 
71  protected:
72 
73  friend class DtPreloadAsyncTask;
75  virtual void markTaskFinished(DtModelDefinition & def);
76 
77  tbb::atomic<int> myNumberOfActiveTasks;
78  tbb::mutex myListMutex;
79  tbb::mutex myStdOutMutex;
80  std::list<osgUtil::StateToCompile*> myToIcoList;
81 
82  // renderer needs access to this to finish preloading not sure the best way to do that.
85  static int myNumFramesTillICO;
86  };
87 
88 
91  class DT_DLL_VRVOSG DtPreloadAsyncTask : public tbb::task
92  {
93  public:
95  DtPreloadAsyncTask(DtDe& de, DtOsgModelPreloader& preloader, DtModelDefinition& definition);
96 
98  virtual ~DtPreloadAsyncTask();
99 
101  virtual tbb::task* execute();
102 
103  protected:
107  static tbb::mutex theModelNewingMutex;
108  static tbb::mutex theOptimizeMutex;
109  };
110 }
std::list< osgUtil::StateToCompile * > myToIcoList
Definition: DtOsgModelPreloader.h:80
static int myNumFramesTillICO
Definition: DtOsgModelPreloader.h:85
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
tbb::mutex myStdOutMutex
Definition: DtOsgModelPreloader.h:79
static tbb::mutex theModelNewingMutex
Definition: DtOsgModelPreloader.h:107
A model definition Interaction any number of named parameters, and also can be used to store cached d...
Definition: DtModelDefinition.h:38
DtOsgModelPreloader is responsible for responding to model preload actions from an agent...
Definition: DtOsgModelPreloader.h:45
DtPreloadAsyncTask is responsible for loading a model in a background thread.
Definition: DtOsgModelPreloader.h:91
tbb::atomic< int > myNumberOfActiveTasks
Definition: DtOsgModelPreloader.h:77
Contains the makVrv::DtModelPreloader class.
static tbb::mutex theOptimizeMutex
Definition: DtOsgModelPreloader.h:108
DtModelDefinition & myDefinition
Definition: DtOsgModelPreloader.h:105
DtOsgModelPreloader & myPreloader
Definition: DtOsgModelPreloader.h:106
static DtOsgModelPreloader * thePreloader
Definition: DtOsgModelPreloader.h:83
Contains makVrv::DtUniqueID type.
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
static int myFramesTillICOCount
Definition: DtOsgModelPreloader.h:84
DtDe & myDe
Definition: DtOsgModelPreloader.h:104
tbb::mutex myListMutex
Definition: DtOsgModelPreloader.h:78
DtModelPreloader is responsible for responding to model preload actions from an agent.
Definition: DtModelPreloader.h:24

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)