[32] | 1 | #pragma once |
---|
| 2 | /* -*-c++-*- osgVisual - Copyright (C) 2009-2010 Torben Dannhauer |
---|
| 3 | * |
---|
| 4 | * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under |
---|
| 5 | * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or |
---|
| 6 | * (at your option) any later version. The full license is in LICENSE file |
---|
| 7 | * included with this distribution, and on the openscenegraph.org website. |
---|
| 8 | * |
---|
| 9 | * osgVisual requires for some proprietary modules a license from the correspondig manufacturer. |
---|
| 10 | * You have to aquire licenses for all used proprietary modules. |
---|
| 11 | * |
---|
| 12 | * This library is distributed in the hope that it will be useful, |
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | * OpenSceneGraph Public License for more details. |
---|
| 16 | */ |
---|
| 17 | |
---|
| 18 | #include <osg/Referenced> |
---|
[97] | 19 | #include <osg/Notify> |
---|
[32] | 20 | |
---|
| 21 | #include <osgViewer/Viewer> |
---|
| 22 | |
---|
| 23 | #include <osgDB/ReadFile> |
---|
| 24 | |
---|
| 25 | // OSG eventhandler |
---|
| 26 | #include <osgViewer/ViewerEventHandlers> |
---|
| 27 | |
---|
| 28 | // OSG manipulator |
---|
| 29 | #include <osgGA/TrackballManipulator> |
---|
| 30 | #include <osgGA/FlightManipulator> |
---|
| 31 | #include <osgGA/DriveManipulator> |
---|
| 32 | #include <osgGA/KeySwitchMatrixManipulator> |
---|
| 33 | #include <osgGA/StateSetManipulator> |
---|
| 34 | #include <osgGA/AnimationPathManipulator> |
---|
| 35 | #include <osgGA/TerrainManipulator> |
---|
| 36 | #include <osgGA/NodeTrackerManipulator> |
---|
| 37 | |
---|
| 38 | // Spacenavigator manipulator |
---|
| 39 | #ifdef USE_SPACENAVIGATOR |
---|
| 40 | #include <manip_spaceMouse.h> |
---|
| 41 | #include <manip_nodeTrackerSpaceMouse.h> |
---|
| 42 | #include <manip_freeSpaceMouse.h> |
---|
| 43 | #endif |
---|
| 44 | |
---|
| 45 | // Object mounted manipulator |
---|
| 46 | #include <manip_objectMounted.h> |
---|
| 47 | |
---|
| 48 | #ifdef USE_DISTORTION |
---|
| 49 | // Distortion |
---|
| 50 | #include <visual_distortion.h> |
---|
| 51 | #endif |
---|
| 52 | |
---|
| 53 | #ifdef USE_SKY_SILVERLINING |
---|
| 54 | // Sky |
---|
[98] | 55 | #include <visual_skySilverLining.h> |
---|
[32] | 56 | #endif |
---|
| 57 | |
---|
| 58 | // DataIO |
---|
| 59 | #include <visual_dataIO.h> |
---|
| 60 | #include <object_updater.h> |
---|
| 61 | |
---|
| 62 | // visual_object |
---|
| 63 | #include <visual_object.h> |
---|
| 64 | |
---|
| 65 | // visual_hud |
---|
| 66 | #include <visual_hud.h> |
---|
| 67 | #include <visual_debug_hud.h> |
---|
| 68 | |
---|
| 69 | // visual_draw2D |
---|
| 70 | #include <visual_draw2D.h> |
---|
| 71 | #include <visual_draw3D.h> |
---|
| 72 | |
---|
| 73 | // visual util |
---|
| 74 | #include <visual_util.h> |
---|
| 75 | |
---|
| 76 | // visual_vista2D |
---|
| 77 | #ifdef USE_VISTA2D |
---|
| 78 | #include <visual_vista2D.h> |
---|
| 79 | #endif |
---|
| 80 | |
---|
| 81 | // Test |
---|
| 82 | #include <dataIO_transportContainer.h> |
---|
| 83 | #include <osgDB/OutputStream> |
---|
| 84 | #include <iostream> |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | |
---|
[57] | 88 | |
---|
[32] | 89 | namespace osgVisual |
---|
| 90 | { |
---|
| 91 | |
---|
| 92 | class visual_core : public osg::Referenced |
---|
| 93 | { |
---|
[88] | 94 | #include <leakDetection.h> |
---|
| 95 | |
---|
[32] | 96 | public: |
---|
| 97 | visual_core(osg::ArgumentParser& arguments_); |
---|
| 98 | void initialize(); |
---|
| 99 | void shutdown(); |
---|
| 100 | |
---|
| 101 | void addManipulators(); |
---|
| 102 | bool loadTerrain(osg::ArgumentParser& arguments_); |
---|
| 103 | bool checkCommandlineArgumentsForFinalErrors(); |
---|
| 104 | |
---|
| 105 | void setupScenery(); |
---|
| 106 | |
---|
| 107 | protected: |
---|
| 108 | virtual ~visual_core(void); |
---|
| 109 | |
---|
| 110 | |
---|
| 111 | private: |
---|
| 112 | void mainLoop(); |
---|
| 113 | |
---|
| 114 | /** |
---|
| 115 | * Argument object, with contains all commandline arguments, which where called during programm sstartup |
---|
| 116 | */ |
---|
| 117 | osg::ArgumentParser& arguments; |
---|
| 118 | |
---|
| 119 | /** |
---|
| 120 | * This CSN is at the top node on the complete scenery. Only the nodes for distortion are located above this node. |
---|
| 121 | */ |
---|
| 122 | osg::ref_ptr<osg::CoordinateSystemNode> rootNode; |
---|
| 123 | |
---|
| 124 | /** |
---|
| 125 | * Reference pointer to the viewer instance. The viewer is the core of the graphical subsystem. |
---|
| 126 | */ |
---|
| 127 | osg::ref_ptr<osgViewer::Viewer> viewer; |
---|
| 128 | |
---|
| 129 | #ifdef USE_SPACENAVIGATOR |
---|
| 130 | /** |
---|
| 131 | * Spacemouse node tracker manipulator |
---|
| 132 | */ |
---|
| 133 | osg::ref_ptr<NodeTrackerSpaceMouse> mouseTrackerManip; |
---|
[55] | 134 | |
---|
| 135 | /** |
---|
| 136 | * Space mouse hardware driver instance |
---|
| 137 | */ |
---|
| 138 | SpaceMouse* mouse; |
---|
[32] | 139 | #endif |
---|
| 140 | |
---|
| 141 | /** |
---|
| 142 | * This Matrix manipulator is used for controlling Camera by Nodes. |
---|
| 143 | */ |
---|
| 144 | osg::ref_ptr<objectMountedManipulator> objectMountedCameraManip; |
---|
| 145 | |
---|
| 146 | |
---|
| 147 | #ifdef USE_SKY_SILVERLINING |
---|
| 148 | /** |
---|
| 149 | * Silverlining Sky instance |
---|
| 150 | */ |
---|
| 151 | osg::ref_ptr<visual_skySilverLining> sky; |
---|
| 152 | #endif |
---|
| 153 | |
---|
| 154 | #ifdef USE_DISTORTION |
---|
| 155 | /** |
---|
| 156 | * Distortion instance. |
---|
| 157 | */ |
---|
| 158 | osg::ref_ptr<visual_distortion> distortion; |
---|
| 159 | #endif |
---|
| 160 | |
---|
| 161 | osg::ref_ptr<visual_object> testObj; |
---|
| 162 | |
---|
| 163 | osg::ref_ptr<osgGA::NodeTrackerManipulator> nt; |
---|
[87] | 164 | |
---|
| 165 | osg::ref_ptr<visual_debug_hud> hud; |
---|
[32] | 166 | }; |
---|
| 167 | |
---|
| 168 | } // END NAMESPACE |
---|