root/OpenSceneGraph/trunk/src/osgManipulator/TabBoxDragger.cpp @ 13041

Revision 13041, 2.7 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is 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 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13//osgManipulator - Copyright (C) 2007 Fugro-Jason B.V.
14
15#include <osgManipulator/TabBoxDragger>
16
17#include <osg/ShapeDrawable>
18#include <osg/Geometry>
19#include <osg/LineWidth>
20#include <osg/Quat>
21
22using namespace osgManipulator;
23
24TabBoxDragger::TabBoxDragger()
25{
26    for (int i=0; i<6; ++i)
27    {
28        _planeDraggers.push_back(new TabPlaneDragger());
29        addChild(_planeDraggers[i].get());
30        addDragger(_planeDraggers[i].get());
31    }
32
33    {
34        _planeDraggers[0]->setMatrix(osg::Matrix::translate(osg::Vec3(0.0,0.5,0.0)));
35    }
36    {
37        osg::Quat rotation; rotation.makeRotate(osg::Vec3(0.0f, -1.0f, 0.0f), osg::Vec3(0.0f, 1.0f, 0.0f));
38        _planeDraggers[1]->setMatrix(osg::Matrix(rotation)*osg::Matrix::translate(osg::Vec3(0.0,-0.5,0.0)));
39    }
40    {
41        osg::Quat rotation; rotation.makeRotate(osg::Vec3(0.0f, 0.0f, 1.0f), osg::Vec3(0.0f, 1.0f, 0.0f));
42        _planeDraggers[2]->setMatrix(osg::Matrix(rotation)*osg::Matrix::translate(osg::Vec3(0.0,0.0,-0.5)));
43    }
44
45    {
46        osg::Quat rotation; rotation.makeRotate(osg::Vec3(0.0f, 1.0f, 0.0f), osg::Vec3(0.0f, 0.0f, 1.0f));
47        _planeDraggers[3]->setMatrix(osg::Matrix(rotation)*osg::Matrix::translate(osg::Vec3(0.0,0.0,0.5)));
48    }
49
50    {
51        osg::Quat rotation; rotation.makeRotate(osg::Vec3(1.0f, 0.0f, 0.0f), osg::Vec3(0.0f, 1.0f, 0.0f));
52        _planeDraggers[4]->setMatrix(osg::Matrix(rotation)*osg::Matrix::translate(osg::Vec3(-0.5,0.0,0.0)));
53    }
54
55    {
56        osg::Quat rotation; rotation.makeRotate(osg::Vec3(0.0f, 1.0f, 0.0f), osg::Vec3(1.0f, 0.0f, 0.0f));
57        _planeDraggers[5]->setMatrix(osg::Matrix(rotation)*osg::Matrix::translate(osg::Vec3(0.5,0.0,0.0)));
58    }
59
60    setParentDragger(getParentDragger());
61}
62
63TabBoxDragger::~TabBoxDragger()
64{
65}
66
67void TabBoxDragger::setupDefaultGeometry()
68{
69    for (unsigned int i=0; i<_planeDraggers.size(); ++i)
70        _planeDraggers[i]->setupDefaultGeometry(false);
71}
72
73void TabBoxDragger::setPlaneColor(const osg::Vec4& color)
74{
75    for (unsigned int i=0; i<_planeDraggers.size(); ++i)
76        _planeDraggers[i]->setPlaneColor(color);
77}
Note: See TracBrowser for help on using the browser.