19 #include <osg/OperationThread>
20 #include <osgUtil/RenderBin>
21 #include <osgViewer/Viewer>
47 class DtEffectManager;
49 class DtOsgWindowManager;
50 class DtOsgProfilerOverlay;
51 class DtOsgPerformanceStatsOverlay;
52 class DtFastMatrixTransform;
55 class DtOsgGlobalShaderComponent;
56 class DtShadowSettingsObject;
57 class DtTaxiwaySignManager;
58 class DtRunwayMarkingManager;
59 class DtLightIndicatorManager;
60 class DtMainThreadJobsManager;
77 const static int SKY_RENDERBIN = -10;
78 const static int DEFAULT_RENDERBIN = 0;
79 const static int DEPTH_ONLY_RENDERBIN = 6;
80 const static int OCEAN_RENDERBIN = 7;
81 const static int LIGHTPOINT_RENDERBIN = 8;
82 const static int CLOUD_RENDERBIN = 9;
83 const static int DEFAULT_TRANSPARENT_RENDERBIN = 10;
84 const static int COCKPIT_RENDERBIN = 25;
105 virtual void update();
108 virtual void render();
111 virtual bool viewExists()
const;
114 virtual void resetSceneGraph();
118 virtual void removeChannelRoot(
DtChannel* channel);
121 virtual void addNodeToRoot(osg::Node* node,
const DtSceneRoot& sr,
bool createOnAccess =
true);
124 virtual void removeNodeFromRoot(osg::Node* node,
const DtSceneRoot& sr);
127 virtual void traverseRoot(osg::NodeVisitor& nv,
const DtSceneRoot& sr);
130 virtual void setSceneRootNodeMask(
const DtSceneRoot& sr,
131 osg::Node::NodeMask nodemask);
134 virtual osg::Node::NodeMask sceneRootNodeMask(
const DtSceneRoot& sr);
137 virtual osg::BoundingSphere sceneRootBound(
const DtSceneRoot& sr);
140 virtual osg::BoundingSphere sceneRootListBound(
const DtSceneRootList& srList);
143 virtual void addChannelToModelSetRoot(
int modelSetId,
147 virtual void removeChannelFromModelSetRoot(
int modelSetId,
151 virtual void addChannelToVisualizerRoot(
int modelSetId,
155 virtual void removeChannelFromVisualizerRoot(
int modelSetId,
159 virtual void setSceneDataToRenderRoot(osgViewer::View& view);
162 virtual void addSceneToCamera(osg::Camera* camera);
168 virtual void addSceneRootToNode(
const DtSceneRoot& sr,
169 osg::Group* node,
bool createOnAccess =
true);
175 virtual osg::Group* findSceneRootChildByName(
const DtSceneRoot& parent,
176 const std::string& rootName);
179 virtual bool matchesSceneRoot(
const DtSceneRoot& sr, osg::Group* group);
182 virtual void releaseResources()
188 virtual void releaseResources(osg::State* state);
192 void setRootNode(osg::Group*,
bool copyChildrenFromOldRoot);
199 void registerPagedLODs(osg::Node* node);
203 void clearPagedLODs();
206 virtual void setWireframeRendering(
bool enabled);
209 virtual void setDdsFlip(
bool flip);
212 virtual bool wireframeRendering()
const;
215 virtual void setShadowState(
bool enabled);
218 virtual bool shadowsEnabled()
const;
221 void setTerrainScalingEnabled(
bool enabled);
224 void setTerrainScaleFactor(
double scaleFactor);
228 virtual bool makeContextCurrent();
245 void debugDrawBox(
const osg::Vec3& center,
const osg::Vec3& extents);
248 void debugDrawBox(
const osg::Vec3& center,
const osg::Vec3& extents,
const osg::Quat& orientation);
251 void setChannelShadowState(
DtOsgChannel* osgChannel,
bool enable);
257 bool getChannelCloudShadowMap(
DtOsgChannel* osgChannel,
unsigned int* textureIndex, osg::Matrix* textureViewProjMatrix,
258 unsigned int* textureIndex2, osg::Matrix* textureViewProjMatrix2);
261 bool getCameraCloudShadowMap(osg::Camera* camera,
unsigned int* textureIndex, osg::Matrix* textureViewProjMatrix,
262 unsigned int* textureIndex2, osg::Matrix* textureViewProjMatrix2);
265 osg::StateSet* sgRenderRootStateSet();
274 void clearStateGraphForAllChannels(
void);
277 virtual void addMainThreadPersistantJob(osg::Operation * opp);
280 virtual void removeMainThreadPersistantJob(osg::Operation * opp);
283 virtual void addMainThreadPreDrawJob(osg::Operation * opp);
286 virtual void addMainThreadTransientJob(osg::Operation * operation);
292 virtual int alphaToCoverageRenderBin();
306 static DtSceneRoot visualizerTypeRoot(
int modelSet,
int visualizerType)
319 osg::Group* sgRenderRoot();
323 osg::Group* sgEnvironmentRoot();
326 osg::Group* sgPropsRoot();
329 osg::Group* sgTerrainRoot();
332 osg::Group* sgScaledTerrainRoot();
335 osg::Group* sgScaledPropsRoot();
338 osg::Group* sgStatic2dDebugRoot();
341 osg::Group* sgStatic3dDebugRoot();
344 osg::Group* sgOceanRoot();
349 virtual void moveRootToShadowRoot(
const DtSceneRoot& targetRoot,
350 osg::Group* shadowRoot, osg::Group* modelSetRoot);
356 virtual osgViewer::ViewerBase& viewer();
368 osg::Group* sgModelSetRoot(
int modelSet);
375 osg::Group* sgVisualizerRoot(
int modelSet,
int visualizerType,
376 bool createOnAccess =
true);
383 osg::Group* sgChannelRoot(
int modelSet,
384 DtChannel* channel,
bool createOnAccess =
true);
387 void slot_onViewCreated();
391 void slot_onViewToBeDestroyed();
394 void slot_onWireframeModeChanged(
bool mode);
397 void slot_onDdsFlipChanged(
bool flip);
400 void slot_onShadowStateChanged(
bool shadowMode);
403 void slot_onTerrainScalingEnabledChanged(
bool enabled);
406 void slot_onTerrainScaleFactorChanged(
double scaleFactor);
409 void slot_onCoordinateSystemChanged(
const std::string& coordinateSystemType);
414 void updateSceneGraph();
418 void clearEmptyWindows();
424 void clearFrameBufferIfChannelChanged();
428 virtual void removeShadows();
431 virtual void createShadowRoots();
436 virtual bool exportTerrainAndProps(
const std::string&);
438 virtual osg::Group* createModelSetRoot(
int modelSet);
439 virtual osg::Group* createVisualizerRoot(
int modelSet,
443 virtual osg::Group* createChannelRoot(
int modelSet,
DtChannel*);
445 virtual osgShadow::ShadowedScene*
446 createModelSetSpecificShadowRootAndScene(
int modelSet);
447 virtual osg::Group* modelSetSpecificShadowRoot(
int modelSet);
448 virtual osgShadow::ShadowedScene*
449 modelSetSpecificShadowScene(
int modelSet);
451 virtual void updateTerrainScaling();
453 virtual void initAerodromeManagers();
454 virtual void updateAerodrome();
457 void swapChildren(osg::Node* currentChild, osg::Node* newChild);
461 virtual void updateRenderMap(
const CullSet& cullSet);
465 void postInitialize();
468 void setupAtcVirtualProgram();
474 static int numDatabasePagerThreads(osgViewer::CompositeViewer& viewer);
477 static void plotHistogram(
float frame_duration,
int paging_threads,
int mipthreads);
480 static void updateLoaderStats(
DtDe & myDe, osgViewer::CompositeViewer &viewer,
481 osg::Texture::TextureObjectManager * tom);
536 typedef boost::unordered_map<int, osg::ref_ptr<osg::Group> >
RootMap;
537 typedef boost::unordered_map<int, osg::ref_ptr<osgShadow::ShadowedScene> >
ShadowedSceneMap;
544 typedef boost::unordered_map < ModelSet, osg::ref_ptr<osg::Group> >
547 typedef boost::unordered_map < VisualizerType, osg::ref_ptr<osg::Group> >
553 typedef boost::unordered_map < ModelSet, VisualizerTypeRootMap >
573 typedef boost::unordered_map < DtChannel*, ModelSetRootMap >