[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 "VistaView.h" |
---|
| 19 | |
---|
[153] | 20 | #include <string> |
---|
| 21 | |
---|
[32] | 22 | #include <osg/Drawable> |
---|
| 23 | #include <osg/Geode> |
---|
| 24 | #include <osg/Projection> |
---|
| 25 | #include <osg/MatrixTransform> |
---|
| 26 | #include <osg/CoordinateSystemNode> |
---|
| 27 | |
---|
| 28 | #include <osgDB/FileUtils> |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | namespace osgVisual |
---|
| 32 | { |
---|
| 33 | |
---|
| 34 | /** |
---|
| 35 | * \brief This class integrates Vista2D by Wetzel Technology into OSG. |
---|
| 36 | * |
---|
| 37 | * It wraps vista2D's OpenGL interface to be usable as a standart OSG Node. The Vista2D nodekit performs auto-linking |
---|
| 38 | * againt the Vista2D library, therefore only three shared libraries have to be copied to the binary folder of the project. |
---|
| 39 | * |
---|
| 40 | * Vista2D ist a software to design HID. This Nodekit enables OSG to display Vista2D project files. |
---|
| 41 | * |
---|
| 42 | * Please copy the following files to the binary folder of you application if you intend to use this nodekit: |
---|
| 43 | * libView.dll |
---|
| 44 | * fontLib.dll |
---|
| 45 | * freetype6.dll |
---|
| 46 | * |
---|
| 47 | * The implementation of this class is based on osg::Drawable. The drawimplementations contains the Vista2D wrap. |
---|
| 48 | * |
---|
| 49 | * @author Torben Dannhauer |
---|
| 50 | * @date Sep 2009 |
---|
| 51 | */ |
---|
| 52 | class visual_vista2D : public osg::Drawable |
---|
| 53 | { |
---|
| 54 | public: |
---|
| 55 | /** |
---|
| 56 | * \brief Construtor: Creates a Vista2D environment which should be wrapt by this node. |
---|
| 57 | * |
---|
| 58 | */ |
---|
| 59 | visual_vista2D(void); |
---|
| 60 | |
---|
| 61 | /** |
---|
| 62 | * \brief Empty destructor. |
---|
| 63 | * |
---|
| 64 | */ |
---|
| 65 | ~visual_vista2D(void); |
---|
| 66 | |
---|
| 67 | /** |
---|
| 68 | * \brief This static function must be called to instantiate a vista2D project. |
---|
| 69 | * |
---|
| 70 | * @param vista2DFilename_ : Vista2D project file to display. |
---|
| 71 | * @param sceneGraphRoot_ : Scenegraph to add the vista2D note as child. |
---|
| 72 | * @return : True if successful. |
---|
| 73 | */ |
---|
[153] | 74 | static bool init( osg::CoordinateSystemNode *sceneGraphRoot_, std::string configFileName ); |
---|
[32] | 75 | |
---|
| 76 | /** |
---|
| 77 | * \brief This function is requiered by subclassing osg::Drawable. |
---|
| 78 | * |
---|
| 79 | * @return : Cloned object. |
---|
| 80 | */ |
---|
| 81 | osg::Object* cloneType() const; |
---|
| 82 | |
---|
| 83 | /** |
---|
| 84 | * \brief This function is requiered by subclassing osg::Drawable. |
---|
| 85 | * |
---|
| 86 | * @param : Copyoperator how to copy the object |
---|
| 87 | * @return : Cloned object. |
---|
| 88 | */ |
---|
| 89 | osg::Object* clone(const osg::CopyOp&) const; |
---|
| 90 | |
---|
| 91 | private: |
---|
[153] | 92 | |
---|
| 93 | bool processXMLConfiguration(); |
---|
| 94 | |
---|
[32] | 95 | /** |
---|
| 96 | * \brief This function initialized the visual_vista2D object after instantiation by createVistaOverlay() |
---|
| 97 | */ |
---|
[153] | 98 | void startVista2D(); |
---|
[32] | 99 | |
---|
| 100 | /** |
---|
| 101 | * \brief This function implements the pure OpenGL draw by calling Vista2D's draw funtion. |
---|
| 102 | * |
---|
| 103 | * Because Visrta2D manipulates OpenGLs stateset, this function saves the |
---|
| 104 | * OSG statset at the beginning and restores it after the drawing of Vista2D |
---|
| 105 | * |
---|
| 106 | * @param renderInfo : Renderinfo of the drawing |
---|
| 107 | */ |
---|
| 108 | void drawImplementation(osg::RenderInfo& renderInfo) const; |
---|
| 109 | |
---|
| 110 | /** |
---|
| 111 | * Pointer to Vista2D's view instance. |
---|
| 112 | */ |
---|
| 113 | Vista2D::VistaView* view; |
---|
[153] | 114 | |
---|
| 115 | /** |
---|
| 116 | * XML config filename |
---|
| 117 | */ |
---|
| 118 | std::string configFileName; |
---|
| 119 | |
---|
| 120 | /** |
---|
| 121 | * Filename of the Vista2D project file. |
---|
| 122 | */ |
---|
| 123 | std::string filename; |
---|
| 124 | |
---|
| 125 | /** |
---|
| 126 | * Should the background of the Vista2D project be painted? |
---|
| 127 | */ |
---|
| 128 | bool paintBackground; |
---|
| 129 | |
---|
| 130 | /** |
---|
| 131 | * X-Position to draw. |
---|
| 132 | */ |
---|
| 133 | int position_x; |
---|
| 134 | |
---|
| 135 | /** |
---|
| 136 | * Y-Position to draw. |
---|
| 137 | */ |
---|
| 138 | int position_y; |
---|
| 139 | |
---|
| 140 | /** |
---|
| 141 | * Zoom factor to draw the project. |
---|
| 142 | */ |
---|
| 143 | double zoom; |
---|
[32] | 144 | }; |
---|
| 145 | |
---|
| 146 | } // END NAMESPACE |
---|