[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> |
---|
| 19 | #include <osg/notify> |
---|
| 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 |
---|
| 55 | #include <visual_skySilverlining.h> |
---|
| 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 | { |
---|
| 94 | public: |
---|
| 95 | visual_core(osg::ArgumentParser& arguments_); |
---|
| 96 | void initialize(); |
---|
| 97 | void shutdown(); |
---|
| 98 | |
---|
| 99 | void addManipulators(); |
---|
| 100 | bool loadTerrain(osg::ArgumentParser& arguments_); |
---|
| 101 | bool checkCommandlineArgumentsForFinalErrors(); |
---|
| 102 | |
---|
| 103 | void setupScenery(); |
---|
| 104 | |
---|
| 105 | protected: |
---|
| 106 | virtual ~visual_core(void); |
---|
| 107 | |
---|
| 108 | |
---|
| 109 | private: |
---|
| 110 | void mainLoop(); |
---|
| 111 | |
---|
| 112 | /** |
---|
| 113 | * Argument object, with contains all commandline arguments, which where called during programm sstartup |
---|
| 114 | */ |
---|
| 115 | osg::ArgumentParser& arguments; |
---|
| 116 | |
---|
| 117 | /** |
---|
| 118 | * This CSN is at the top node on the complete scenery. Only the nodes for distortion are located above this node. |
---|
| 119 | */ |
---|
| 120 | osg::ref_ptr<osg::CoordinateSystemNode> rootNode; |
---|
| 121 | |
---|
| 122 | /** |
---|
| 123 | * Reference pointer to the viewer instance. The viewer is the core of the graphical subsystem. |
---|
| 124 | */ |
---|
| 125 | osg::ref_ptr<osgViewer::Viewer> viewer; |
---|
| 126 | |
---|
| 127 | #ifdef USE_SPACENAVIGATOR |
---|
| 128 | /** |
---|
| 129 | * Spacemouse node tracker manipulator |
---|
| 130 | */ |
---|
| 131 | osg::ref_ptr<NodeTrackerSpaceMouse> mouseTrackerManip; |
---|
[55] | 132 | |
---|
| 133 | /** |
---|
| 134 | * Space mouse hardware driver instance |
---|
| 135 | */ |
---|
| 136 | SpaceMouse* mouse; |
---|
[32] | 137 | #endif |
---|
| 138 | |
---|
| 139 | /** |
---|
| 140 | * This Matrix manipulator is used for controlling Camera by Nodes. |
---|
| 141 | */ |
---|
| 142 | osg::ref_ptr<objectMountedManipulator> objectMountedCameraManip; |
---|
| 143 | |
---|
| 144 | |
---|
| 145 | #ifdef USE_SKY_SILVERLINING |
---|
| 146 | /** |
---|
| 147 | * Silverlining Sky instance |
---|
| 148 | */ |
---|
| 149 | osg::ref_ptr<visual_skySilverLining> sky; |
---|
| 150 | #endif |
---|
| 151 | |
---|
| 152 | #ifdef USE_DISTORTION |
---|
| 153 | /** |
---|
| 154 | * Distortion instance. |
---|
| 155 | */ |
---|
| 156 | osg::ref_ptr<visual_distortion> distortion; |
---|
| 157 | #endif |
---|
| 158 | |
---|
| 159 | osg::ref_ptr<visual_object> testObj; |
---|
| 160 | |
---|
| 161 | osg::ref_ptr<osgGA::NodeTrackerManipulator> nt; |
---|
| 162 | }; |
---|
| 163 | |
---|
| 164 | } // END NAMESPACE |
---|