1 | /* -*-c++-*- osgVisual - Copyright (C) 2009-2011 Torben Dannhauer |
---|
2 | * |
---|
3 | * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under |
---|
4 | * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or |
---|
5 | * (at your option) any later version. The full license is in LICENSE file |
---|
6 | * included with this distribution, and on the openscenegraph.org website. |
---|
7 | * |
---|
8 | * osgVisual requires for some proprietary modules a license from the correspondig manufacturer. |
---|
9 | * You have to aquire licenses for all used proprietary modules. |
---|
10 | * |
---|
11 | * This library is distributed in the hope that it will be useful, |
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | * OpenSceneGraph Public License for more details. |
---|
15 | */ |
---|
16 | #include <manip_extLink.h> |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | using namespace osg; |
---|
21 | using namespace osgGA; |
---|
22 | using namespace osgVisual; |
---|
23 | |
---|
24 | extLinkManipulator::extLinkManipulator() |
---|
25 | { |
---|
26 | } |
---|
27 | |
---|
28 | extLinkManipulator::~extLinkManipulator() |
---|
29 | { |
---|
30 | } |
---|
31 | |
---|
32 | void extLinkManipulator::init(const GUIEventAdapter& ,GUIActionAdapter& ) |
---|
33 | { |
---|
34 | } |
---|
35 | |
---|
36 | void extLinkManipulator::getUsage(osg::ApplicationUsage& usage) const |
---|
37 | { |
---|
38 | } |
---|
39 | |
---|
40 | bool extLinkManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) |
---|
41 | { |
---|
42 | switch(ea.getEventType()) |
---|
43 | { |
---|
44 | case(GUIEventAdapter::FRAME): |
---|
45 | if (attachedObject.valid()) |
---|
46 | { |
---|
47 | setByMatrix( attachedObject->getCameraMatrix() ); |
---|
48 | } |
---|
49 | return false; |
---|
50 | default: |
---|
51 | break; |
---|
52 | } |
---|
53 | |
---|
54 | return false; |
---|
55 | } |
---|
56 | |
---|
57 | void extLinkManipulator::setByMatrix(const osg::Matrixd& matrix) |
---|
58 | { |
---|
59 | manipMatrix = matrix; |
---|
60 | } |
---|
61 | |
---|
62 | osg::Matrixd extLinkManipulator::getMatrix() const |
---|
63 | { |
---|
64 | return manipMatrix; |
---|
65 | } |
---|
66 | |
---|
67 | osg::Matrixd extLinkManipulator::getInverseMatrix() const |
---|
68 | { |
---|
69 | return osg::Matrixd::inverse(manipMatrix); |
---|
70 | } |
---|