OsgUnitBox.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_GRAPHICS_OSGUNITBOX_H
17 #define SURGSIM_GRAPHICS_OSGUNITBOX_H
18 
19 #include <osg/Geode>
20 #include <osg/Shape>
21 #include <osg/ShapeDrawable>
22 
23 namespace SurgSim
24 {
25 
26 namespace Graphics
27 {
28 
33 {
34 public:
37  m_geode(new osg::Geode())
38  {
39  osg::ref_ptr<osg::Box> unitBox = new osg::Box(osg::Vec3(0.0, 0.0, 0.0), 1.0);
40  osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable(unitBox);
41  m_geode->addDrawable(drawable);
42  m_geode->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
43  }
44 
46  osg::ref_ptr<osg::Node> getNode() const
47  {
48  return m_geode;
49  }
50 
51 private:
53  osg::ref_ptr<osg::Geode> m_geode;
54 };
55 
56 }; // namespace Graphics
57 
58 }; // namespace SurgSim
59 
60 #endif // SURGSIM_GRAPHICS_OSGUNITBOX_H
Definition: DriveElementFromInputBehavior.cpp:27
osg::ref_ptr< osg::Node > getNode() const
Returns the root OSG node for the plane to be inserted into the scene-graph.
Definition: OsgUnitBox.h:46
OSG unit box geode to be used as a primitive shape The box is located at (0, 0, 0) and has a size of ...
Definition: OsgUnitBox.h:32
osg::ref_ptr< osg::Geode > m_geode
Root OSG node of the box.
Definition: OsgUnitBox.h:53
OsgUnitBox()
Constructor.
Definition: OsgUnitBox.h:36
Definition: OsgLight.h:33