19 #include <osg/OperationThread>
20 #include <osgUtil/RenderBin>
21 #include <osgViewer/Viewer>
35 class CompositeViewer;
53 class DtEffectManager;
55 class DtOsgWindowManager;
56 class DtOsgProfilerOverlay;
57 class DtOsgPerformanceStatsOverlay;
58 class DtFastMatrixTransform;
60 class DtOsgGlobalShaderComponent;
61 class DtOsgCullVisitor;
62 class DtShadowSettingsObject;
63 class DtTaxiwaySignManager;
64 class DtRunwayMarkingManager;
65 class DtLightIndicatorManager;
66 class DtMainThreadJobsManager;
67 class DtImGuiLoaderStatsData;
77 virtual void traverse(osg::NodeVisitor& nv);
98 const static int SKY_RENDERBIN = -10;
99 const static int DEFAULT_RENDERBIN = 0;
100 const static int DEPTH_ONLY_RENDERBIN = 5;
101 const static int OCEAN_RENDERBIN = 6;
102 const static int LIGHTPOINT_RENDERBIN = 7;
103 const static int CLOUD_RENDERBIN = 8;
104 const static int OCCLUSION_RENDERBIN = 9;
105 const static int DEFAULT_TRANSPARENT_RENDERBIN = 10;
106 const static int COCKPIT_RENDERBIN = 25;
129 virtual void cleanup()
override;
132 virtual void update();
135 virtual void render();
138 virtual bool viewExists()
const;
141 virtual void resetSceneGraph();
145 virtual void removeChannelRoot(
DtChannel* channel);
152 virtual bool isSceneRootEmpty(
const DtSceneRoot& sr);
155 virtual void addNodeToRoot(osg::Node* node,
const DtSceneRoot& sr,
bool createOnAccess =
true);
158 virtual void addSceneRootToRoot(
const DtSceneRoot& childRoot,
const DtSceneRoot& parentRoot,
bool createOnAccess =
true);
161 virtual void removeNodeFromRoot(osg::Node* node,
const DtSceneRoot& sr);
168 virtual void traverseRoot(osg::NodeVisitor& nv,
const DtSceneRoot& sr);
171 virtual void setSceneRootNodeMask(
const DtSceneRoot& sr,
172 osg::Node::NodeMask nodemask);
175 virtual osg::Node::NodeMask sceneRootNodeMask(
const DtSceneRoot& sr);
178 virtual osg::BoundingSphere sceneRootBound(
const DtSceneRoot& sr);
181 virtual osg::BoundingSphere sceneRootListBound(
const DtSceneRootList& srList);
184 virtual void addChannelToModelSetRoot(
int modelSetId,
188 virtual void removeChannelFromModelSetRoot(
int modelSetId,
192 virtual void addChannelToVisualizerRoot(
int modelSetId,
196 virtual void removeChannelFromVisualizerRoot(
int modelSetId,
200 virtual void setSceneDataToRenderRoot(osgViewer::View& view);
203 virtual void addSceneToCamera(osg::Camera* camera);
209 virtual void addSceneRootToNode(
const DtSceneRoot& sr,
210 osg::Group* node,
bool createOnAccess =
true);
216 virtual osg::Group* findSceneRootChildByName(
const DtSceneRoot& parent,
217 const std::string& rootName);
220 virtual bool matchesSceneRoot(
const DtSceneRoot& sr, osg::Group* group);
229 virtual void releaseResources(osg::State* state);
233 void setRootNode(osg::Group*,
bool copyChildrenFromOldRoot);
240 void registerPagedLODs(osg::Node* node);
244 void clearPagedLODs();
247 virtual void setWireframeRendering(
bool enabled);
250 virtual void setDdsFlip(
bool flip);
253 virtual bool wireframeRendering()
const;
256 virtual void setShadowState(
bool enabled);
259 virtual bool shadowsEnabled()
const;
262 virtual bool multiViewVrEnabled()
const;
265 virtual void setMultiViewVrEnabled(
bool enabled);
268 virtual DtMultiViewData& getOrCreateMultiViewData(osg::Camera* camera);
271 void setTerrainScalingEnabled(
bool enabled);
274 void setTerrainScaleFactor(
double scaleFactor);
278 virtual bool makeContextCurrent();
297 virtual void debugDrawBox(
const osg::Vec3& center,
const osg::Vec3& extents);
300 virtual void debugDrawBox(
const osg::Vec3& center,
const osg::Vec3& extents,
const osg::Quat& orientation);
303 virtual void setChannelShadowState(
DtOsgChannel* osgChannel,
bool enable);
309 virtual bool channelCloudShadowMap(
DtOsgChannel* osgChannel,
unsigned int* textureIndex, osg::Matrix* textureViewProjMatrix,
310 unsigned int* textureIndex2, osg::Matrix* textureViewProjMatrix2)
const;
313 virtual bool cameraCloudShadowMap(osg::Camera* camera,
unsigned int* textureIndex, osg::Matrix* textureViewProjMatrix,
314 unsigned int* textureIndex2, osg::Matrix* textureViewProjMatrix2)
const;
317 osg::StateSet* sgRenderRootStateSet();
326 void clearStateGraphForAllChannels(
void);
329 virtual void addMainThreadPersistantJob(osg::Operation * opp);
332 virtual void removeMainThreadPersistantJob(osg::Operation * opp);
335 virtual void addMainThreadPreDrawJob(osg::Operation * opp);
338 virtual void addParallelThreadCullJob(osg::Operation * opp);
341 virtual void removeParallelThreadCullJob(osg::Operation* opp);
344 virtual void addParallelThreadSwapBufferJob(osg::Operation * opp);
347 virtual bool addMainThreadTransientJob(osg::Operation * operation,
bool requiredThisFrame);
353 virtual void launchSwapBufferTasks();
359 virtual int alphaToCoverageRenderBin();
393 return theShadowedSceneName;
399 osg::Group* sgRenderRoot();
403 osg::Group* sgEnvironmentRoot();
406 osg::Group* sgPropsRoot();
409 osg::Group* sgIntersectoOnlyPropsRoot();
412 osg::Group* sgTerrainRoot();
415 osg::Group* sgScaledTerrainRoot();
418 osg::Group* sgScaledPropsRoot();
421 osg::Group* sgMinimapTerrainRoot();
424 osg::Group* sgMinimapFallbackTerrainRoot(
bool createOnAccess);
427 osg::Group* sgNormalizedOverlayRoot();
430 osg::Group* sgStatic3dDebugRoot();
433 osg::Group* sgOceanRoot();
436 virtual osg::Group* modelSetSpecificShadowRoot(
int modelSet);
439 virtual osgShadow::ShadowedScene*
440 modelSetSpecificShadowScene(
int modelSet);
444 osg::Group* sgIntersectOnlyRoot(
int modelSet);
450 virtual osgViewer::ViewerBase& viewer();
454 virtual void clearMainThreadJobsManager();
464 virtual void addIntStat(
const std::string& name,
int value);
467 virtual void addFloatStat(
const std::string& name,
float value);
471 virtual void addIntStat(
const std::string& subsystem,
const std::string& name,
int value);
474 virtual void addFloatStat(
const std::string& subsystem,
const std::string& name,
float value);
479 virtual unsigned int numActiveThreads();
487 virtual void moveRootToShadowRoot(
const DtSceneRoot& targetRoot,
488 osg::Group* shadowRoot, osg::Group* modelSetRoot);
501 osg::Group* sgModelSetRoot(
int modelSet);
508 osg::Group* sgVisualizerRoot(
int modelSet,
int visualizerType,
509 bool createOnAccess =
true);
516 osg::Group* sgChannelRoot(
int modelSet,
517 DtChannel* channel,
bool createOnAccess =
true);
520 void slot_onViewCreated();
524 void slot_onViewToBeDestroyed();
527 void slot_onWireframeModeChanged(
bool mode);
530 void slot_onDdsFlipChanged(
bool flip);
533 void slot_onOcclusionCullingChanged(
bool enabled);
536 void slot_onShadowStateChanged(
bool shadowMode);
539 void slot_onTerrainScalingEnabledChanged(
bool enabled);
542 void slot_onTerrainScaleFactorChanged(
double scaleFactor);
545 void slot_onCoordinateSystemChanged(
const std::string& coordinateSystemType);
547 void updateSceneGraph();
551 void clearEmptyWindows();
557 void clearFrameBufferIfChannelChanged();
561 virtual void removeShadows();
564 virtual void createShadowRoots();
569 virtual bool exportTerrainAndProps(
const std::string&);
571 virtual osg::Group* createModelSetRoot(
int modelSet);
572 virtual osg::Group* createVisualizerRoot(
int modelSet,
576 virtual osg::Group* createChannelRoot(
int modelSet,
DtChannel*);
579 virtual osgShadow::ShadowedScene*
580 createModelSetSpecificShadowRootAndScene(
int modelSet);
582 virtual void updateTerrainScaling();
584 virtual void initAerodromeManagers();
585 virtual void updateAerodrome();
588 void swapChildren(osg::Node* currentChild, osg::Node* newChild);
592 void postInitialize();
595 void setupAtcVirtualProgram();
598 virtual void processBackgroundLoaderIcoTasks();
604 virtual void runMainThreadJobs(
double timeBudget);
610 static int numDatabasePagerThreads(osgViewer::CompositeViewer& viewer);
613 static void plotHistogram(
float frame_duration,
int paging_threads,
int mipthreads);
679 typedef boost::unordered_map<int, osg::ref_ptr<osg::Group> >
RootMap;
680 typedef boost::unordered_map<int, osg::ref_ptr<osgShadow::ShadowedScene> >
ShadowedSceneMap;
687 typedef boost::unordered_map < ModelSet, osg::ref_ptr<osg::Group> >
690 typedef boost::unordered_map < VisualizerType, osg::ref_ptr<osg::Group> >
696 typedef boost::unordered_map < ModelSet, VisualizerTypeRootMap >
720 typedef boost::unordered_map < DtChannel*, ModelSetRootMap >
static const std::string LightPointBin
Definition: DtOsgRenderer.h:113
ModelSetRootMap myIntersectOnlyRootMap
Definition: DtOsgRenderer.h:706
static DtSceneRoot thePropRoot
Definition: DtOsgRenderer.h:767
Definition: DtTaxiwaySignManager.h:91
static const std::string SkyBin
Definition: DtOsgRenderer.h:110
osg::ref_ptr< osg::Group > myDebugRoot
Group for drawing debug graphics, cleared after each frame.
Definition: DtOsgRenderer.h:635
Definition: DtRunwayMarkingManager.h:148
The DtOsgRenderer is the component responsible for rendering 3D images onto the screen via OpenSceneG...
Definition: DtOsgRenderer.h:90
osg::ref_ptr< osgViewer::Viewer > myDefaultViewer
This viewer exists so that when there are no displays, windows, or channels, the scene can be updated...
Definition: DtOsgRenderer.h:629
boost::signalslib::signal< void(bool active) > signal_treeProfilingChanged
Definition: DtOsgRenderer.h:291
RootMap myShadowRootMap
Definition: DtOsgRenderer.h:725
static const std::string OcclusionRenderBin
Definition: DtOsgRenderer.h:115
Definition: DtShadowSettingsObject.h:24
static DtSceneRoot theNormalizedOverlayRoot
Definition: DtOsgRenderer.h:770
std::vector< DtSceneRoot > DtSceneRootList
A list of DtOsgRenderer::SceneRoots.
Definition: DtSceneRoot.h:133
osg::ref_ptr< osgUtil::RenderBin > mySkyBin
Definition: DtOsgRenderer.h:728
OperationVector myParallelSwapBufferJobs
Definition: DtOsgRenderer.h:782
ShadowedSceneMap myShadowedSceneMap
Definition: DtOsgRenderer.h:724
boost::unordered_map< ModelSet, osg::ref_ptr< osg::Group > > ModelSetRootMap
Definition: DtOsgRenderer.h:688
std::vector< OperationRef > OperationVector
Definition: DtOsgRenderer.h:779
bool myTerrainScaleFactorChanged
Definition: DtOsgRenderer.h:747
A light weight system for running jobs in the main thread during cull Transient Jobs run once and are...
Definition: DtMainThreadJobsManager.h:80
osg::ref_ptr< osg::Group > myRenderRoot
Definition: DtOsgRenderer.h:632
virtual void releaseResources()
Release all openGL objects in the scene graph.
Definition: DtOsgRenderer.h:223
boost::unordered_map< int, osg::ref_ptr< osgShadow::ShadowedScene > > ShadowedSceneMap
Definition: DtOsgRenderer.h:680
int VisualizerType
Definition: DtOsgRenderer.h:683
static DtSceneRoot theTerrainRoot
Definition: DtOsgRenderer.h:764
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
osg::ref_ptr< osgUtil::RenderBin > myOceanBin
Definition: DtOsgRenderer.h:730
ChannelRootMap myChannelRootMap
Definition: DtOsgRenderer.h:723
boost::unordered_map< int, osg::ref_ptr< osg::Group > > RootMap
Definition: DtOsgRenderer.h:679
osg::ref_ptr< osgUtil::RenderBin > myDepthOnlyBin
Definition: DtOsgRenderer.h:729
Contains makVrv::DtOverlayManager class.
DtOsgWindowManager * myOsgWindowManager
Definition: DtOsgRenderer.h:622
boost::signalslib::signal< void() > signal_shadowsRemoved
Definition: DtOsgRenderer.h:294
osg::ref_ptr< osg::Group > myMinimapFallbackTerrainRoot
Definition: DtOsgRenderer.h:657
bool myTerrainScalingEnabled
Definition: DtOsgRenderer.h:748
osg::ref_ptr< osg::Geode > myDebugBox
Shared geometry for debug boxes.
Definition: DtOsgRenderer.h:644
Definition: DtImGuiHelper.h:28
boost::unordered_map< VisualizerType, osg::ref_ptr< osg::Group > > VisualizerTypeRootMap
Definition: DtOsgRenderer.h:691
boost::unordered_map< ModelSet, VisualizerTypeRootMap > ModelSetVisualizerTypeRootMap
Under each model set group is another channel group for each visualizer type.
Definition: DtOsgRenderer.h:697
osg::ref_ptr< osgUtil::RenderBin > myOcclusionNodeBin
Definition: DtOsgRenderer.h:734
DtTaxiwaySignManager * myTaxiwaySignManager
Definition: DtOsgRenderer.h:742
DtRunwayMarkingManager * myRunwayMarkingManager
Definition: DtOsgRenderer.h:743
osg::ref_ptr< DtOsgGlobalShaderComponent > myGlobalShaderComponent
Definition: DtOsgRenderer.h:776
osg::ref_ptr< DtFastMatrixTransform > myScaledPropsRoot
Definition: DtOsgRenderer.h:674
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:77
const char * myStatGroupName
Definition: DtOsgRenderer.h:79
bool myInitializedInRender
Definition: DtOsgRenderer.h:758
bool myWireframeOn
Definition: DtOsgRenderer.h:736
Manages instances of fonts, the font will be kept in memory unless the manager is cleared...
Definition: DtFontManager.h:28
ModelSetVisualizerTypeRootMap myVisualizerRootMap
Definition: DtOsgRenderer.h:711
osg::ref_ptr< osgUtil::RenderBin > myAlphaToCoverageBin
Definition: DtOsgRenderer.h:727
class that gathers per frame stats and puts up UI
Definition: DtImGuiLoaderStatsData.h:42
Definition: DtLightIndicatorManager.h:76
static DtSceneRoot theMinimapFallbackTerrainRoot
Definition: DtOsgRenderer.h:766
unsigned int myActiveThreads
Definition: DtOsgRenderer.h:759
DtOsgCullVisitor will inspect the camera to see which visual mode is active.
Definition: DtOsgCullVisitor.h:25
static DtSceneRoot theEnvironmentRoot
Definition: DtOsgRenderer.h:763
static const std::string OceanBin
Definition: DtOsgRenderer.h:112
The abstract Channel Class.
Definition: DtChannel.h:30
static DtSceneRoot theRenderRoot
Definition: DtOsgRenderer.h:762
class DtImguiHelper * myImGuiHelper
Definition: DtOsgRenderer.h:774
boost::unordered_map< DtChannel *, ModelSetRootMap > ChannelRootMap
DtChannelSpecificGroup that contains only the channel it represents.
Definition: DtOsgRenderer.h:721
Abstract index into the scene graph.
Definition: DtSceneRoot.h:22
bool myTerrainScalingEnabledChanged
Definition: DtOsgRenderer.h:749
bool myReaddJobSystem
Definition: DtOsgRenderer.h:756
static const std::string & shadowedSceneName(void)
Definition: DtOsgRenderer.h:391
osg::ref_ptr< osg::Group > myTerrainRoot
Definition: DtOsgRenderer.h:650
static DtSceneRoot modelSetRoot(int modelSet)
Definition: DtOsgRenderer.h:377
boost::signalslib::signal< void(DtChannel *) > signal_channelRootAdded
Definition: DtOsgRenderer.h:289
static DtSceneRoot visualizerTypeRoot(int modelSet, int visualizerType)
Definition: DtOsgRenderer.h:381
DtMainThreadJobsManager * myMainThreadJobsManager
system for doing work during cull
Definition: DtOsgRenderer.h:755
static DtSceneRoot theOceanRoot
Definition: DtOsgRenderer.h:768
Logic for scene graph tree display widget.
Definition: DtSceneGraphTreeLogic.h:256
osg::ref_ptr< osg::Group > myStatic3dDebugRoot
Group for drawing debug graphics left alone each frame.
Definition: DtOsgRenderer.h:641
osg::ref_ptr< osgUtil::RenderBin > myCockpitBin
Definition: DtOsgRenderer.h:733
static const std::string AlphaToCoverageBin
Definition: DtOsgRenderer.h:109
The effect manager provides a way of creating and sharing effects.
Definition: DtEffectManager.h:18
static DtSceneRoot theIntersectOnlyPropRoot
Definition: DtOsgRenderer.h:769
Abstract creator base class.
Definition: DtOsgRenderer.h:787
std::map< osg::Camera *, DtMultiViewData * > myMultiViewData
Definition: DtOsgRenderer.h:740
simple class to encapsulate the different views in a multiview vr setup
Definition: DtMultiViewData.h:23
osg::Matrix myScaleMatrix
Definition: DtOsgRenderer.h:676
osg::ref_ptr< osgUtil::RenderBin > myLightPointBin
Definition: DtOsgRenderer.h:731
Owns and manages OpenSceneGraph windows.
Definition: DtOsgWindowManager.h:32
DtLightIndicatorManager * myLightIndicatorManager
Definition: DtOsgRenderer.h:744
The DtRenderer is the component responsible for rendering 3D images onto the screen.
Definition: DtRenderer.h:43
double myTerrainScaleFactor
Definition: DtOsgRenderer.h:746
OperationVector myParallelCullJobs
Definition: DtOsgRenderer.h:781
osg::ref_ptr< osg::Group > myEnvironmentRoot
Definition: DtOsgRenderer.h:647
static DtSceneRoot theMinimapTerrainRoot
Definition: DtOsgRenderer.h:765
static const std::string DepthOnlyBin
Definition: DtOsgRenderer.h:111
Definition: DtSceneRoot.h:41
Contains makVrv::DtSceneRoot class.
Abstract creator base class.
Definition: DtRenderer.h:159
DtFontManager * myFontManager
Definition: DtOsgRenderer.h:619
osg::ref_ptr< osg::Operation > OperationRef
Definition: DtOsgRenderer.h:778
int ModelSet
Definition: DtOsgRenderer.h:682
bool myMultiViewVrEnabled
Definition: DtOsgRenderer.h:739
osg::ref_ptr< osg::Group > myMinimapTerrainRoot
Definition: DtOsgRenderer.h:653
static DtSceneRoot channelRoot(int modelSet, DtChannel *channel)
Definition: DtOsgRenderer.h:385
boost::signalslib::signal< void(int modelSet, int visualType) > signal_visualizerRootAdded
Definition: DtOsgRenderer.h:288
const char int mode
Definition: ioapi.h:38
bool myResourcesReleased
Definition: DtOsgRenderer.h:750
boost::signalslib::signal< void(bool active) > signal_diguyProfilingChanged
Definition: DtOsgRenderer.h:292
ModelSetRootMap myModelSetMap
Definition: DtOsgRenderer.h:703
static const std::string CloudBin
Definition: DtOsgRenderer.h:114
osg::ref_ptr< osg::Group > myOceanRoot
Definition: DtOsgRenderer.h:666
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
osg::ref_ptr< DtFastMatrixTransform > myScaledTerrainRoot
Definition: DtOsgRenderer.h:670
virtual DtImguiHelper * imGuiHelper()
Definition: DtOsgRenderer.h:476
static std::string theShadowedSceneName
Definition: DtOsgRenderer.h:772
DtEffectManager * myEffectManager
Definition: DtOsgRenderer.h:620
osg::ref_ptr< osg::Group > myPropsRoot
Definition: DtOsgRenderer.h:660
simple class that allows a group to get automatically profiled with both DtPROFILE markers and concur...
Definition: DtOsgRenderer.h:73
const char * myTraverseName
Definition: DtOsgRenderer.h:80
osg::ref_ptr< osg::Group > myIntersectOnlyPropsRoot
Definition: DtOsgRenderer.h:663
static DtSceneRoot intersectOnlyRoot(int modelSet)
Definition: DtOsgRenderer.h:372
static const std::string CockpitBin
Definition: DtOsgRenderer.h:116
int myAlphaToCoverageRenderBin
Definition: DtOsgRenderer.h:752
osg::ref_ptr< osgUtil::RenderBin > myCloudBin
Definition: DtOsgRenderer.h:732
osg::ref_ptr< osg::Group > myNormalizedOverlayRoot
Group for drawing debug graphics left alone each frame.
Definition: DtOsgRenderer.h:638
bool myShadowsEnabled
Definition: DtOsgRenderer.h:737
Abstraction over the OSG scene graph.
Definition: DtSceneGraph.h:22
DtSceneGraph * mySceneGraph
Definition: DtOsgRenderer.h:617
Contains the DtOsgGlobalShaderComponent class.