OpenCOVER
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
24namespace vrui
25{
26
27class coSquareButtonGeometry;
28class OSGVruiTransformNode;
29
34{
35public:
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
49
50 virtual void createGeometry();
51 virtual void resizeGeometry();
52
54
55protected:
57 osg::ref_ptr<osg::Node> createGeode(const std::string &textureName, int style);
59
60 osg::ref_ptr<osg::Node> normalNode;
61 osg::ref_ptr<osg::Node> pressedNode;
62 osg::ref_ptr<osg::Node> highlightNode;
64 osg::ref_ptr<osg::Node> pressedHighlightNode;
65 osg::ref_ptr<osg::Node> disabledNode;
66
67 osg::ref_ptr<osg::Switch> switchNode;
68
70
72
73private:
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
collaborative interface manager
Definition: coVRCommunication.h:41
ActiveGeometry
Definition: coButtonGeometry.h:33
Definition: coSquareButtonGeometry.h:23
Definition: vruiButtonProvider.h:21
Definition: vruiTransformNode.h:18
Definition: OSGVruiSquareButtonGeometry.h:34
osg::ref_ptr< osg::Node > pressedHighlightNode
Definition: OSGVruiSquareButtonGeometry.h:64
osg::ref_ptr< osg::Node > pressedNode
pressed normal geometry
Definition: OSGVruiSquareButtonGeometry.h:61
osg::ref_ptr< osg::Node > normalNode
normal geometry
Definition: OSGVruiSquareButtonGeometry.h:60
virtual float getWidth() const
Definition: OSGVruiSquareButtonGeometry.h:39
virtual float getHeight() const
Definition: OSGVruiSquareButtonGeometry.h:43
osg::ref_ptr< osg::Node > highlightNode
pressed highlighted geometry
Definition: OSGVruiSquareButtonGeometry.h:62
virtual void switchGeometry(coButtonGeometry::ActiveGeometry active)
osg::ref_ptr< osg::Node > createGeode(const std::string &textureName, int style)
< creates the base button polygon
virtual vruiTransformNode * getDCS()
OSGVruiTransformNode * myDCS
Definition: OSGVruiSquareButtonGeometry.h:71
osg::ref_ptr< osg::Node > disabledNode
Definition: OSGVruiSquareButtonGeometry.h:65
osg::ref_ptr< osg::Switch > switchNode
Definition: OSGVruiSquareButtonGeometry.h:67
OSGVruiSquareButtonGeometry(coSquareButtonGeometry *button)
void createSharedLists()
creates shared coordinate arrays
coSquareButtonGeometry * button
Definition: OSGVruiSquareButtonGeometry.h:69
Definition: OSGVruiTransformNode.h:26