1 | /* -*-c++-*- osgVisual - Copyright (C) 2009-2010 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 | |
---|
17 | #include <manip_objectMounted.h> |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | using namespace osg; |
---|
22 | using namespace osgGA; |
---|
23 | using namespace osgVisual; |
---|
24 | |
---|
25 | objectMountedManipulator::objectMountedManipulator() |
---|
26 | { |
---|
27 | #include <leakDetection.h> |
---|
28 | } |
---|
29 | |
---|
30 | objectMountedManipulator::~objectMountedManipulator() |
---|
31 | { |
---|
32 | } |
---|
33 | |
---|
34 | void objectMountedManipulator::init(const GUIEventAdapter& ,GUIActionAdapter& ) |
---|
35 | { |
---|
36 | } |
---|
37 | |
---|
38 | void objectMountedManipulator::getUsage(osg::ApplicationUsage& usage) const |
---|
39 | { |
---|
40 | } |
---|
41 | |
---|
42 | bool objectMountedManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) |
---|
43 | { |
---|
44 | switch(ea.getEventType()) |
---|
45 | { |
---|
46 | case(GUIEventAdapter::FRAME): |
---|
47 | if (attachedObject.valid()) |
---|
48 | { |
---|
49 | setByMatrix( attachedObject->getCameraMatrix() ); |
---|
50 | } |
---|
51 | return false; |
---|
52 | default: |
---|
53 | break; |
---|
54 | } |
---|
55 | |
---|
56 | return false; |
---|
57 | } |
---|
58 | |
---|
59 | void objectMountedManipulator::setByMatrix(const osg::Matrixd& matrix) |
---|
60 | { |
---|
61 | manipMatrix = matrix; |
---|
62 | } |
---|
63 | |
---|
64 | osg::Matrixd objectMountedManipulator::getMatrix() const |
---|
65 | { |
---|
66 | return manipMatrix; |
---|
67 | } |
---|
68 | |
---|
69 | osg::Matrixd objectMountedManipulator::getInverseMatrix() const |
---|
70 | { |
---|
71 | return osg::Matrixd::inverse(manipMatrix); |
---|
72 | } |
---|