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);
91 const osg::Vec3& cullViewOffset()
const;
94 void setCullViewOffset(
const osg::Vec3&
offset);
97 const osg::Matrix& projection(
unsigned int index)
const;
100 void setProjection(
const osg::Matrix& projection,
unsigned int index);
103 const osg::Vec3& viewOffset(
unsigned int index)
const;
106 void setViewOffset(
const osg::Vec3& offset,
unsigned int index);
133 const static int SKY_RENDERBIN = -10;
134 const static int DEFAULT_RENDERBIN = 0;
135 const static int DEPTH_ONLY_RENDERBIN = 5;
136 const static int OCEAN_RENDERBIN = 6;
137 const static int LIGHTPOINT_RENDERBIN = 7;
138 const static int CLOUD_RENDERBIN = 8;
139 const static int OCCLUSION_RENDERBIN = 9;
140 const static int DEFAULT_TRANSPARENT_RENDERBIN = 10;
141 const static int COCKPIT_RENDERBIN = 25;
163 virtual void update();
166 virtual void render();
169 virtual bool viewExists()
const;
172 virtual void resetSceneGraph();
176 virtual void removeChannelRoot(
DtChannel* channel);
183 virtual bool isSceneRootEmpty(
const DtSceneRoot& sr);
186 virtual void addNodeToRoot(osg::Node* node,
const DtSceneRoot& sr,
bool createOnAccess =
true);
189 virtual void addSceneRootToRoot(
const DtSceneRoot& childRoot,
const DtSceneRoot& parentRoot,
bool createOnAccess =
true);
192 virtual void removeNodeFromRoot(osg::Node* node,
const DtSceneRoot& sr);
199 virtual void traverseRoot(osg::NodeVisitor& nv,
const DtSceneRoot& sr);
202 virtual void setSceneRootNodeMask(
const DtSceneRoot& sr,
203 osg::Node::NodeMask nodemask);
206 virtual osg::Node::NodeMask sceneRootNodeMask(
const DtSceneRoot& sr);
209 virtual osg::BoundingSphere sceneRootBound(
const DtSceneRoot& sr);
212 virtual osg::BoundingSphere sceneRootListBound(
const DtSceneRootList& srList);
215 virtual void addChannelToModelSetRoot(
int modelSetId,
219 virtual void removeChannelFromModelSetRoot(
int modelSetId,
223 virtual void addChannelToVisualizerRoot(
int modelSetId,
227 virtual void removeChannelFromVisualizerRoot(
int modelSetId,
231 virtual void setSceneDataToRenderRoot(osgViewer::View& view);
234 virtual void addSceneToCamera(osg::Camera* camera);
240 virtual void addSceneRootToNode(
const DtSceneRoot& sr,
241 osg::Group* node,
bool createOnAccess =
true);
247 virtual osg::Group* findSceneRootChildByName(
const DtSceneRoot& parent,
248 const std::string& rootName);
251 virtual bool matchesSceneRoot(
const DtSceneRoot& sr, osg::Group* group);
260 virtual void releaseResources(osg::State* state);
264 void setRootNode(osg::Group*,
bool copyChildrenFromOldRoot);
271 void registerPagedLODs(osg::Node* node);
275 void clearPagedLODs();
278 virtual void setWireframeRendering(
bool enabled);
281 virtual void setDdsFlip(
bool flip);
284 virtual bool wireframeRendering()
const;
287 virtual void setShadowState(
bool enabled);
290 virtual bool shadowsEnabled()
const;
293 virtual bool multiViewVrEnabled()
const;
296 virtual void setMultiViewVrEnabled(
bool enabled);
302 void setTerrainScalingEnabled(
bool enabled);
305 void setTerrainScaleFactor(
double scaleFactor);
309 virtual bool makeContextCurrent();
328 virtual void debugDrawBox(
const osg::Vec3& center,
const osg::Vec3& extents);
331 virtual void debugDrawBox(
const osg::Vec3& center,
const osg::Vec3& extents,
const osg::Quat& orientation);
334 virtual void setChannelShadowState(
DtOsgChannel* osgChannel,
bool enable);
340 virtual bool channelCloudShadowMap(
DtOsgChannel* osgChannel,
unsigned int* textureIndex, osg::Matrix* textureViewProjMatrix,
341 unsigned int* textureIndex2, osg::Matrix* textureViewProjMatrix2)
const;
344 virtual bool cameraCloudShadowMap(osg::Camera* camera,
unsigned int* textureIndex, osg::Matrix* textureViewProjMatrix,
345 unsigned int* textureIndex2, osg::Matrix* textureViewProjMatrix2)
const;
348 osg::StateSet* sgRenderRootStateSet();
357 void clearStateGraphForAllChannels(
void);
360 virtual void addMainThreadPersistantJob(osg::Operation * opp);
363 virtual void removeMainThreadPersistantJob(osg::Operation * opp);
366 virtual void addMainThreadPreDrawJob(osg::Operation * opp);
369 virtual void addParallelThreadCullJob(osg::Operation * opp);
372 virtual void removeParallelThreadCullJob(osg::Operation* opp);
375 virtual void addParallelThreadSwapBufferJob(osg::Operation * opp);
378 virtual bool addMainThreadTransientJob(osg::Operation * operation,
bool requiredThisFrame);
384 virtual void launchSwapBufferTasks();
390 virtual int alphaToCoverageRenderBin();
418 return theShadowedSceneName;
424 osg::Group* sgRenderRoot();
428 osg::Group* sgEnvironmentRoot();
431 osg::Group* sgPropsRoot();
434 osg::Group* sgTerrainRoot();
437 osg::Group* sgScaledTerrainRoot();
440 osg::Group* sgScaledPropsRoot();
443 osg::Group* sgMinimapTerrainRoot();
446 osg::Group* sgMinimapFallbackTerrainRoot();
449 osg::Group* sgStatic2dDebugRoot();
452 osg::Group* sgStatic3dDebugRoot();
455 osg::Group* sgOceanRoot();
458 virtual osg::Group* modelSetSpecificShadowRoot(
int modelSet);
461 virtual osgShadow::ShadowedScene*
462 modelSetSpecificShadowScene(
int modelSet);
468 virtual osgViewer::ViewerBase& viewer();
472 virtual void clearMainThreadJobsManager();
482 virtual void addIntStat(
const std::string& name,
int value);
485 virtual void addFloatStat(
const std::string& name,
float value);
489 virtual void addIntStat(
const std::string& subsystem,
const std::string& name,
int value);
492 virtual void addFloatStat(
const std::string& subsystem,
const std::string& name,
float value);
497 virtual unsigned int numActiveThreads();
502 virtual void moveRootToShadowRoot(
const DtSceneRoot& targetRoot,
503 osg::Group* shadowRoot, osg::Group* modelSetRoot);
516 osg::Group* sgModelSetRoot(
int modelSet);
523 osg::Group* sgVisualizerRoot(
int modelSet,
int visualizerType,
524 bool createOnAccess =
true);
531 osg::Group* sgChannelRoot(
int modelSet,
532 DtChannel* channel,
bool createOnAccess =
true);
535 void slot_onViewCreated();
539 void slot_onViewToBeDestroyed();
542 void slot_onWireframeModeChanged(
bool mode);
545 void slot_onDdsFlipChanged(
bool flip);
548 void slot_onOcclusionCullingChanged(
bool enabled);
551 void slot_onShadowStateChanged(
bool shadowMode);
554 void slot_onTerrainScalingEnabledChanged(
bool enabled);
557 void slot_onTerrainScaleFactorChanged(
double scaleFactor);
560 void slot_onCoordinateSystemChanged(
const std::string& coordinateSystemType);
565 void updateSceneGraph();
569 void clearEmptyWindows();
575 void clearFrameBufferIfChannelChanged();
579 virtual void removeShadows();
582 virtual void createShadowRoots();
587 virtual bool exportTerrainAndProps(
const std::string&);
589 virtual osg::Group* createModelSetRoot(
int modelSet);
590 virtual osg::Group* createVisualizerRoot(
int modelSet,
594 virtual osg::Group* createChannelRoot(
int modelSet,
DtChannel*);
597 virtual osgShadow::ShadowedScene*
598 createModelSetSpecificShadowRootAndScene(
int modelSet);
600 virtual void updateTerrainScaling();
602 virtual void initAerodromeManagers();
603 virtual void updateAerodrome();
606 void swapChildren(osg::Node* currentChild, osg::Node* newChild);
610 virtual void updateRenderMap(
const CullSet& cullSet);
614 void postInitialize();
617 void setupAtcVirtualProgram();
620 virtual void processBackgroundLoaderIcoTasks();
626 virtual void runMainThreadJobs(
double timeBudget);
632 static int numDatabasePagerThreads(osgViewer::CompositeViewer& viewer);
635 static void plotHistogram(
float frame_duration,
int paging_threads,
int mipthreads);
698 typedef boost::unordered_map<int, osg::ref_ptr<osg::Group> >
RootMap;
699 typedef boost::unordered_map<int, osg::ref_ptr<osgShadow::ShadowedScene> >
ShadowedSceneMap;
706 typedef boost::unordered_map < ModelSet, osg::ref_ptr<osg::Group> >
709 typedef boost::unordered_map < VisualizerType, osg::ref_ptr<osg::Group> >
715 typedef boost::unordered_map < ModelSet, VisualizerTypeRootMap >
735 typedef boost::unordered_map < DtChannel*, ModelSetRootMap >
static const std::string LightPointBin
Definition: DtOsgRenderer.h:148
static DtSceneRoot thePropRoot
Definition: DtOsgRenderer.h:782
Definition: DtTaxiwaySignManager.h:91
static const std::string SkyBin
Definition: DtOsgRenderer.h:145
osg::ref_ptr< osg::Group > myDebugRoot
Group for drawing debug graphics, cleared after each frame.
Definition: DtOsgRenderer.h:657
Contains makVrv::DtInstanceManager declaration.
Definition: DtRunwayMarkingManager.h:148
The DtOsgRenderer is the component responsible for rendering 3D images onto the screen via OpenSceneG...
Definition: DtOsgRenderer.h:125
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:651
RootMap myShadowRootMap
Definition: DtOsgRenderer.h:740
static const std::string OcclusionRenderBin
Definition: DtOsgRenderer.h:150
Definition: DtShadowSettingsObject.h:24
std::vector< DtSceneRoot > DtSceneRootList
A list of DtOsgRenderer::SceneRoots.
Definition: DtSceneRoot.h:117
osg::ref_ptr< osgUtil::RenderBin > mySkyBin
Definition: DtOsgRenderer.h:743
OperationVector myParallelSwapBufferJobs
Definition: DtOsgRenderer.h:794
ShadowedSceneMap myShadowedSceneMap
Definition: DtOsgRenderer.h:739
boost::unordered_map< ModelSet, osg::ref_ptr< osg::Group > > ModelSetRootMap
Definition: DtOsgRenderer.h:707
std::vector< OperationRef > OperationVector
Definition: DtOsgRenderer.h:791
bool myTerrainScaleFactorChanged
Definition: DtOsgRenderer.h:762
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:654
virtual void releaseResources()
Release all openGL objects in the scene graph.
Definition: DtOsgRenderer.h:254
boost::unordered_map< int, osg::ref_ptr< osgShadow::ShadowedScene > > ShadowedSceneMap
Definition: DtOsgRenderer.h:699
int VisualizerType
Definition: DtOsgRenderer.h:702
static DtSceneRoot theTerrainRoot
Definition: DtOsgRenderer.h:779
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
osg::ref_ptr< osgUtil::RenderBin > myOceanBin
Definition: DtOsgRenderer.h:745
ChannelRootMap myChannelRootMap
Definition: DtOsgRenderer.h:738
boost::unordered_map< int, osg::ref_ptr< osg::Group > > RootMap
Definition: DtOsgRenderer.h:698
osg::ref_ptr< osgUtil::RenderBin > myDepthOnlyBin
Definition: DtOsgRenderer.h:744
Contains makVrv::DtOverlayManager class.
DtOsgWindowManager * myOsgWindowManager
Definition: DtOsgRenderer.h:644
DtMultiViewData myMultiViewData
Definition: DtOsgRenderer.h:755
osg::ref_ptr< osg::Group > myMinimapFallbackTerrainRoot
Definition: DtOsgRenderer.h:679
bool myTerrainScalingEnabled
Definition: DtOsgRenderer.h:763
osg::ref_ptr< osg::Geode > myDebugBox
Shared geometry for debug boxes.
Definition: DtOsgRenderer.h:666
Definition: DtImGuiHelper.h:28
boost::unordered_map< VisualizerType, osg::ref_ptr< osg::Group > > VisualizerTypeRootMap
Definition: DtOsgRenderer.h:710
boost::unordered_map< ModelSet, VisualizerTypeRootMap > ModelSetVisualizerTypeRootMap
Under each model set group is another channel group for each visualizer type.
Definition: DtOsgRenderer.h:716
osg::ref_ptr< osgUtil::RenderBin > myOcclusionNodeBin
Definition: DtOsgRenderer.h:749
DtTaxiwaySignManager * myTaxiwaySignManager
Definition: DtOsgRenderer.h:757
DtRunwayMarkingManager * myRunwayMarkingManager
Definition: DtOsgRenderer.h:758
osg::ref_ptr< DtOsgGlobalShaderComponent > myGlobalShaderComponent
Definition: DtOsgRenderer.h:788
osg::ref_ptr< DtFastMatrixTransform > myScaledPropsRoot
Definition: DtOsgRenderer.h:693
std::vector< osg::Vec3 > myViewOffsets
offsets from the main camera for each view
Definition: DtOsgRenderer.h:116
std::vector< osg::Matrix > myProjections
projection matrix for each view
Definition: DtOsgRenderer.h:113
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:75
const char * myStatGroupName
Definition: DtOsgRenderer.h:79
bool myInitializedInRender
Definition: DtOsgRenderer.h:773
bool myWireframeOn
Definition: DtOsgRenderer.h:751
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:726
osg::ref_ptr< osgUtil::RenderBin > myAlphaToCoverageBin
Definition: DtOsgRenderer.h:742
class that gathers per frame stats and puts up UI
Definition: DtImGuiLoaderStatsData.h:36
Definition: DtLightIndicatorManager.h:76
static DtSceneRoot theMinimapFallbackTerrainRoot
Definition: DtOsgRenderer.h:781
unsigned int myActiveThreads
Definition: DtOsgRenderer.h:774
DtOsgCullVisitor will inspect the camera to see which visual mode is active.
Definition: DtOsgCullVisitor.h:25
static DtSceneRoot theEnvironmentRoot
Definition: DtOsgRenderer.h:778
static const std::string OceanBin
Definition: DtOsgRenderer.h:147
The abstract Channel Class.
Definition: DtChannel.h:29
static DtSceneRoot theRenderRoot
Definition: DtOsgRenderer.h:777
class DtImguiHelper * myImGuiHelper
Definition: DtOsgRenderer.h:786
boost::unordered_map< DtChannel *, ModelSetRootMap > ChannelRootMap
DtChannelSpecificGroup that contains only the channel it represents.
Definition: DtOsgRenderer.h:736
Abstract index into the scene graph.
Definition: DtSceneRoot.h:19
bool myTerrainScalingEnabledChanged
Definition: DtOsgRenderer.h:764
boost::signal< void(int modelSet, int visualType) > signal_visualizerRootAdded
Definition: DtOsgRenderer.h:319
osg::Vec3 myCullViewOffset
view space offset for the camera when culling so the main camera frustum encapsulates the multiview f...
Definition: DtOsgRenderer.h:110
bool myReaddJobSystem
Definition: DtOsgRenderer.h:771
static const std::string & shadowedSceneName(void)
Definition: DtOsgRenderer.h:416
boost::signal< void(bool active) > signal_treeProfilingChanged
Definition: DtOsgRenderer.h:322
boost::signal< void() > signal_shadowsRemoved
Definition: DtOsgRenderer.h:325
osg::ref_ptr< osg::Group > myTerrainRoot
Definition: DtOsgRenderer.h:672
static DtSceneRoot modelSetRoot(int modelSet)
Definition: DtOsgRenderer.h:402
static DtSceneRoot visualizerTypeRoot(int modelSet, int visualizerType)
Definition: DtOsgRenderer.h:406
DtMainThreadJobsManager * myMainThreadJobsManager
system for doing work during cull
Definition: DtOsgRenderer.h:770
static DtSceneRoot theOceanRoot
Definition: DtOsgRenderer.h:783
boost::signal< void(DtChannel *) > signal_channelRootAdded
Definition: DtOsgRenderer.h:320
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:663
osg::ref_ptr< osgUtil::RenderBin > myCockpitBin
Definition: DtOsgRenderer.h:748
static const std::string AlphaToCoverageBin
Definition: DtOsgRenderer.h:144
The effect manager provides a way of creating and sharing effects.
Definition: DtEffectManager.h:21
Abstract creator base class.
Definition: DtOsgRenderer.h:799
simple class to encapsulate the different views in a multiview vr setup
Definition: DtOsgRenderer.h:85
osg::Matrix myScaleMatrix
Definition: DtOsgRenderer.h:695
osg::ref_ptr< osgUtil::RenderBin > myLightPointBin
Definition: DtOsgRenderer.h:746
Owns and manages OpenSceneGraph windows.
Definition: DtOsgWindowManager.h:35
DtLightIndicatorManager * myLightIndicatorManager
Definition: DtOsgRenderer.h:759
The DtRenderer is the component responsible for rendering 3D images onto the screen.
Definition: DtRenderer.h:43
double myTerrainScaleFactor
Definition: DtOsgRenderer.h:761
OperationVector myParallelCullJobs
Definition: DtOsgRenderer.h:793
osg::ref_ptr< osg::Group > myEnvironmentRoot
Definition: DtOsgRenderer.h:669
static DtSceneRoot theMinimapTerrainRoot
Definition: DtOsgRenderer.h:780
static const std::string DepthOnlyBin
Definition: DtOsgRenderer.h:146
Contains makVrv::DtSceneRoot class.
Abstract creator base class.
Definition: DtRenderer.h:153
DtFontManager * myFontManager
Definition: DtOsgRenderer.h:641
osg::ref_ptr< osg::Operation > OperationRef
Definition: DtOsgRenderer.h:790
int ModelSet
Definition: DtOsgRenderer.h:701
bool myMultiViewVrEnabled
Definition: DtOsgRenderer.h:754
osg::ref_ptr< osg::Group > myMinimapTerrainRoot
Definition: DtOsgRenderer.h:675
static DtSceneRoot channelRoot(int modelSet, DtChannel *channel)
Definition: DtOsgRenderer.h:410
osg::ref_ptr< osg::Group > myStatic2dDebugRoot
Group for drawing debug graphics left alone each frame.
Definition: DtOsgRenderer.h:660
const char int mode
Definition: ioapi.h:38
bool myResourcesReleased
Definition: DtOsgRenderer.h:765
ModelSetRootMap myModelSetMap
Definition: DtOsgRenderer.h:722
static const std::string CloudBin
Definition: DtOsgRenderer.h:149
osg::ref_ptr< osg::Group > myOceanRoot
Definition: DtOsgRenderer.h:685
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:689
virtual DtImguiHelper * imGuiHelper()
Definition: DtOsgRenderer.h:494
static std::string theShadowedSceneName
Definition: DtOsgRenderer.h:784
voidpf uLong offset
Definition: ioapi.h:42
DtEffectManager * myEffectManager
Definition: DtOsgRenderer.h:642
osg::ref_ptr< osg::Group > myPropsRoot
Definition: DtOsgRenderer.h:682
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
std::vector< DtUniqueID > CullSet
Definition: DtInstancedCullSet.h:16
static const std::string CockpitBin
Definition: DtOsgRenderer.h:151
int myAlphaToCoverageRenderBin
Definition: DtOsgRenderer.h:767
osg::ref_ptr< osgUtil::RenderBin > myCloudBin
Definition: DtOsgRenderer.h:747
bool myShadowsEnabled
Definition: DtOsgRenderer.h:752
Abstraction over the OSG scene graph.
Definition: DtSceneGraph.h:22
DtSceneGraph * mySceneGraph
Definition: DtOsgRenderer.h:639
Contains the DtOsgGlobalShaderComponent class.
boost::signal< void(bool active) > signal_diguyProfilingChanged
Definition: DtOsgRenderer.h:323