OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Point.h
Go to the documentation of this file.
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 
14 #ifndef OSG_POINT
15 #define OSG_POINT 1
16 
17 #include <osg/Vec3>
18 #include <osg/StateAttribute>
19 
20 #ifndef GL_POINT_SMOOTH
21  #define GL_POINT_SMOOTH 0x0B10
22 #endif
23 
24 #ifndef GL_POINT_SMOOTH_HINT
25  #define GL_POINT_SMOOTH_HINT 0x0C51
26 #endif
27 
28 namespace osg {
29 
32 {
33  public :
34 
35  Point();
36 
37  Point(float size);
38 
40  Point(const Point& point,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
41  StateAttribute(point,copyop),
42  _size(point._size),
43  _fadeThresholdSize(point._fadeThresholdSize),
44  _distanceAttenuation(point._distanceAttenuation),
45  _minSize(point._minSize),
46  _maxSize(point._maxSize) {}
47 
48  META_StateAttribute(osg, Point, POINT);
49 
51  virtual int compare(const StateAttribute& sa) const
52  {
53  // check the types are equal and then create the rhs variable
54  // used by the COMPARE_StateAttribute_Parameter macros below.
56 
57  // compare each parameter in turn against the rhs.
59  COMPARE_StateAttribute_Parameter(_fadeThresholdSize)
60  COMPARE_StateAttribute_Parameter(_distanceAttenuation)
63 
64  return 0; // passed all the above comparison macros, must be equal.
65  }
66 
67  virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
68  {
70  return true;
71  }
72 
73  void setSize(float size);
74  inline float getSize() const { return _size; }
75 
76  void setFadeThresholdSize(float fadeThresholdSize);
77  inline float getFadeThresholdSize() const { return _fadeThresholdSize; }
78 
79  void setDistanceAttenuation(const Vec3& distanceAttenuation);
80  inline const Vec3& getDistanceAttenuation() const { return _distanceAttenuation; }
81 
82  void setMinSize(float minSize);
83  inline float getMinSize() const {return _minSize;}
84 
85  void setMaxSize(float maxSize);
86  inline float getMaxSize() const {return _maxSize;}
87 
88  virtual void apply(State& state) const;
89 
90  protected :
91 
92  virtual ~Point();
93 
94  float _size;
97  float _minSize;
98  float _maxSize;
99 
100 };
101 
102 }
103 
104 #endif
#define OSG_EXPORT
Definition: Export.h:43
float getMinSize() const
Definition: Point.h:83
virtual int compare(const StateAttribute &sa) const
Definition: Point.h:51
float _fadeThresholdSize
Definition: Point.h:95
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
virtual void usesMode(GLMode mode)=0
virtual bool getModeUsage(StateAttribute::ModeUsage &usage) const
Definition: Point.h:67
Point(const Point &point, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: Point.h:40
float _minSize
Definition: Point.h:97
Vec3 _distanceAttenuation
Definition: Point.h:96
float _maxSize
Definition: Point.h:98
#define META_StateAttribute(library, name, type)
float getMaxSize() const
Definition: Point.h:86
PointArray::value_type Point
Definition: Types.h:29
float getSize() const
Definition: Point.h:74
Definition: AlphaFunc.h:19
#define COMPARE_StateAttribute_Parameter(parameter)
const Vec3 & getDistanceAttenuation() const
Definition: Point.h:80
float getFadeThresholdSize() const
Definition: Point.h:77
#define GL_POINT_SMOOTH
Definition: Point.h:21
float _size
Definition: Point.h:94