19 #include <osg/OperationThread>
20 #include <osgUtil/RenderBin>
21 #include <osgViewer/Viewer>
34 class CompositeViewer;
52 class DtEffectManager;
54 class DtOsgWindowManager;
55 class DtOsgProfilerOverlay;
56 class DtOsgPerformanceStatsOverlay;
57 class DtFastMatrixTransform;
60 class DtOsgGlobalShaderComponent;
61 class DtShadowSettingsObject;
62 class DtTaxiwaySignManager;
63 class DtRunwayMarkingManager;
64 class DtLightIndicatorManager;
65 class DtMainThreadJobsManager;
82 const static int SKY_RENDERBIN = -10;
83 const static int DEFAULT_RENDERBIN = 0;
84 const static int DEPTH_ONLY_RENDERBIN = 6;
85 const static int OCEAN_RENDERBIN = 7;
86 const static int LIGHTPOINT_RENDERBIN = 8;
87 const static int CLOUD_RENDERBIN = 9;
88 const static int DEFAULT_TRANSPARENT_RENDERBIN = 10;
89 const static int COCKPIT_RENDERBIN = 25;
110 virtual void update();
113 virtual void render();
116 virtual bool viewExists()
const;
119 virtual void resetSceneGraph();
123 virtual void removeChannelRoot(
DtChannel* channel);
126 virtual void addNodeToRoot(osg::Node* node,
const DtSceneRoot& sr,
bool createOnAccess =
true);
129 virtual void removeNodeFromRoot(osg::Node* node,
const DtSceneRoot& sr);
132 virtual void traverseRoot(osg::NodeVisitor& nv,
const DtSceneRoot& sr);
135 virtual void setSceneRootNodeMask(
const DtSceneRoot& sr,
136 osg::Node::NodeMask nodemask);
139 virtual osg::Node::NodeMask sceneRootNodeMask(
const DtSceneRoot& sr);
142 virtual osg::BoundingSphere sceneRootBound(
const DtSceneRoot& sr);
145 virtual osg::BoundingSphere sceneRootListBound(
const DtSceneRootList& srList);
148 virtual void addChannelToModelSetRoot(
int modelSetId,
152 virtual void removeChannelFromModelSetRoot(
int modelSetId,
156 virtual void addChannelToVisualizerRoot(
int modelSetId,
160 virtual void removeChannelFromVisualizerRoot(
int modelSetId,
164 virtual void setSceneDataToRenderRoot(osgViewer::View& view);
167 virtual void addSceneToCamera(osg::Camera* camera);
173 virtual void addSceneRootToNode(
const DtSceneRoot& sr,
174 osg::Group* node,
bool createOnAccess =
true);
180 virtual osg::Group* findSceneRootChildByName(
const DtSceneRoot& parent,
181 const std::string& rootName);
184 virtual bool matchesSceneRoot(
const DtSceneRoot& sr, osg::Group* group);
187 virtual void releaseResources()
193 virtual void releaseResources(osg::State* state);
197 void setRootNode(osg::Group*,
bool copyChildrenFromOldRoot);
204 void registerPagedLODs(osg::Node* node);
208 void clearPagedLODs();
211 virtual void setWireframeRendering(
bool enabled);
214 virtual void setDdsFlip(
bool flip);
217 virtual bool wireframeRendering()
const;
220 virtual void setShadowState(
bool enabled);
223 virtual bool shadowsEnabled()
const;
226 void setTerrainScalingEnabled(
bool enabled);
229 void setTerrainScaleFactor(
double scaleFactor);
233 virtual bool makeContextCurrent();
250 void debugDrawBox(
const osg::Vec3& center,
const osg::Vec3& extents);
253 void debugDrawBox(
const osg::Vec3& center,
const osg::Vec3& extents,
const osg::Quat& orientation);
256 void setChannelShadowState(
DtOsgChannel* osgChannel,
bool enable);
262 bool getChannelCloudShadowMap(
DtOsgChannel* osgChannel,
unsigned int* textureIndex, osg::Matrix* textureViewProjMatrix,
263 unsigned int* textureIndex2, osg::Matrix* textureViewProjMatrix2);
266 bool getCameraCloudShadowMap(osg::Camera* camera,
unsigned int* textureIndex, osg::Matrix* textureViewProjMatrix,
267 unsigned int* textureIndex2, osg::Matrix* textureViewProjMatrix2);
270 osg::StateSet* sgRenderRootStateSet();
279 void clearStateGraphForAllChannels(
void);
282 virtual void addMainThreadPersistantJob(osg::Operation * opp);
285 virtual void removeMainThreadPersistantJob(osg::Operation * opp);
288 virtual void addMainThreadPreDrawJob(osg::Operation * opp);
291 virtual void addMainThreadTransientJob(osg::Operation * operation);
297 virtual int alphaToCoverageRenderBin();
311 static DtSceneRoot visualizerTypeRoot(
int modelSet,
int visualizerType)
324 osg::Group* sgRenderRoot();
328 osg::Group* sgEnvironmentRoot();
331 osg::Group* sgPropsRoot();
334 osg::Group* sgTerrainRoot();
337 osg::Group* sgScaledTerrainRoot();
340 osg::Group* sgScaledPropsRoot();
343 osg::Group* sgStatic2dDebugRoot();
346 osg::Group* sgStatic3dDebugRoot();
349 osg::Group* sgOceanRoot();
354 virtual void moveRootToShadowRoot(
const DtSceneRoot& targetRoot,
355 osg::Group* shadowRoot, osg::Group* modelSetRoot);
361 virtual osgViewer::ViewerBase& viewer();
373 osg::Group* sgModelSetRoot(
int modelSet);
380 osg::Group* sgVisualizerRoot(
int modelSet,
int visualizerType,
381 bool createOnAccess =
true);
388 osg::Group* sgChannelRoot(
int modelSet,
389 DtChannel* channel,
bool createOnAccess =
true);
392 void slot_onViewCreated();
396 void slot_onViewToBeDestroyed();
399 void slot_onWireframeModeChanged(
bool mode);
402 void slot_onDdsFlipChanged(
bool flip);
405 void slot_onShadowStateChanged(
bool shadowMode);
408 void slot_onTerrainScalingEnabledChanged(
bool enabled);
411 void slot_onTerrainScaleFactorChanged(
double scaleFactor);
414 void slot_onCoordinateSystemChanged(
const std::string& coordinateSystemType);
419 void updateSceneGraph();
423 void clearEmptyWindows();
429 void clearFrameBufferIfChannelChanged();
433 virtual void removeShadows();
436 virtual void createShadowRoots();
441 virtual bool exportTerrainAndProps(
const std::string&);
443 virtual osg::Group* createModelSetRoot(
int modelSet);
444 virtual osg::Group* createVisualizerRoot(
int modelSet,
448 virtual osg::Group* createChannelRoot(
int modelSet,
DtChannel*);
450 virtual osgShadow::ShadowedScene*
451 createModelSetSpecificShadowRootAndScene(
int modelSet);
452 virtual osg::Group* modelSetSpecificShadowRoot(
int modelSet);
453 virtual osgShadow::ShadowedScene*
454 modelSetSpecificShadowScene(
int modelSet);
456 virtual void updateTerrainScaling();
458 virtual void initAerodromeManagers();
459 virtual void updateAerodrome();
462 void swapChildren(osg::Node* currentChild, osg::Node* newChild);
466 virtual void updateRenderMap(
const CullSet& cullSet);
470 void postInitialize();
473 void setupAtcVirtualProgram();
479 static int numDatabasePagerThreads(osgViewer::CompositeViewer& viewer);
482 static void plotHistogram(
float frame_duration,
int paging_threads,
int mipthreads);
485 static void updateLoaderStats(
DtDe & myDe, osgViewer::CompositeViewer &viewer,
486 osg::Texture::TextureObjectManager * tom);
541 typedef boost::unordered_map<int, osg::ref_ptr<osg::Group> >
RootMap;
542 typedef boost::unordered_map<int, osg::ref_ptr<osgShadow::ShadowedScene> >
ShadowedSceneMap;
549 typedef boost::unordered_map < ModelSet, osg::ref_ptr<osg::Group> >
552 typedef boost::unordered_map < VisualizerType, osg::ref_ptr<osg::Group> >
558 typedef boost::unordered_map < ModelSet, VisualizerTypeRootMap >
578 typedef boost::unordered_map < DtChannel*, ModelSetRootMap >