OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OSGVruiSquareButtonGeometry.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 //-*-c++-*-
9 #ifndef OSG_VRUI_SQUARE_BUTTON_GEOMETRY_H
10 #define OSG_VRUI_SQUARE_BUTTON_GEOMETRY_H
11 
13 
14 #include <osg/Array>
15 #include <osg/Geode>
16 #include <osg/Material>
17 #include <osg/PrimitiveSet>
18 #include <osg/StateSet>
19 #include <osg/Switch>
20 #include <osg/Vec3>
21 
22 #include <string>
23 
24 namespace vrui
25 {
26 
27 class coSquareButtonGeometry;
28 class OSGVruiTransformNode;
29 
33 class OSGVRUIEXPORT OSGVruiSquareButtonGeometry : public vruiButtonProvider
34 {
35 public:
37  virtual ~OSGVruiSquareButtonGeometry();
38 
39  virtual float getWidth() const
40  {
41  return 2.0f * (A + B) + C;
42  }
43  virtual float getHeight() const
44  {
45  return 2.0f * (A + B) + C;
46  }
47 
48  virtual void switchGeometry(coButtonGeometry::ActiveGeometry active);
49 
50  virtual void createGeometry();
51  virtual void resizeGeometry();
52 
53  virtual vruiTransformNode *getDCS();
54 
55 protected:
57  osg::ref_ptr<osg::Node> createGeode(const std::string &textureName, int style);
58  void createSharedLists();
59 
60  osg::ref_ptr<osg::Node> normalNode;
61  osg::ref_ptr<osg::Node> pressedNode;
62  osg::ref_ptr<osg::Node> highlightNode;
63  osg::ref_ptr<osg::Node> pressedHighlightNode;
65  osg::ref_ptr<osg::Node> disabledNode;
66 
67  osg::ref_ptr<osg::Switch> switchNode;
68 
70 
72 
73 private:
74  //shared coord and color list
75  static float A;
76  static float B;
77  static float C;
78 
79  static osg::ref_ptr<osg::Vec4Array> color;
80  static osg::ref_ptr<osg::Vec3Array> coord1;
81  static osg::ref_ptr<osg::Vec3Array> coord2;
82  static osg::ref_ptr<osg::Vec3Array> coordt1;
83  static osg::ref_ptr<osg::Vec3Array> coordt2;
84  static osg::ref_ptr<osg::Vec3Array> normal1;
85  static osg::ref_ptr<osg::Vec3Array> normal2;
86  static osg::ref_ptr<osg::Vec3Array> normalt;
88  static osg::ref_ptr<osg::Vec2Array> texCoord;
89 
90  static osg::ref_ptr<osg::DrawElementsUShort> coordIndex;
91 
92  static osg::ref_ptr<osg::Material> textureMat;
93  static osg::ref_ptr<osg::StateSet> normalStateSet;
94 };
95 }
96 #endif
osg::ref_ptr< osg::Node > normalNode
normal geometry
Definition: OSGVruiSquareButtonGeometry.h:60
Definition: vruiTransformNode.h:17
Definition: vruiButtonProvider.h:20
virtual float getHeight() const
Definition: OSGVruiSquareButtonGeometry.h:43
osg::ref_ptr< osg::Node > pressedNode
pressed normal geometry
Definition: OSGVruiSquareButtonGeometry.h:61
OSGVruiTransformNode * myDCS
Definition: OSGVruiSquareButtonGeometry.h:71
ActiveGeometry
Definition: coButtonGeometry.h:32
Definition: coSquareButtonGeometry.h:22
coSquareButtonGeometry * button
Definition: OSGVruiSquareButtonGeometry.h:69
osg::ref_ptr< osg::Node > highlightNode
pressed highlighted geometry
Definition: OSGVruiSquareButtonGeometry.h:62
Definition: OSGVruiTransformNode.h:25
Definition: OSGVruiSquareButtonGeometry.h:33
osg::ref_ptr< osg::Node > disabledNode
Definition: OSGVruiSquareButtonGeometry.h:65
osg::ref_ptr< osg::Switch > switchNode
Definition: OSGVruiSquareButtonGeometry.h:67
virtual float getWidth() const
Definition: OSGVruiSquareButtonGeometry.h:39