OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LineStipple.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 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_LINESTIPPLE
15 #define OSG_LINESTIPPLE 1
16 
17 #include <osg/StateAttribute>
18 
19 #ifndef GL_LINE_STIPPLE
20  #define GL_LINE_STIPPLE 0x0B24
21 #endif
22 
23 namespace osg {
24 
26 {
27  public :
28 
29  LineStipple();
30 
31  LineStipple(GLint factor, GLushort pattern):
32  _factor(factor),
33  _pattern(pattern) {}
34 
37  StateAttribute(lw,copyop),
38  _factor(lw._factor),
39  _pattern(lw._pattern) {}
40 
41  META_StateAttribute(osg, LineStipple, LINESTIPPLE);
42 
44  virtual int compare(const StateAttribute& sa) const
45  {
46  // check if the types are equal and then create the rhs variable.
47  // used by the COMPARE_StateAttribute_Parameter macros below.
49 
50  // compare each parameter in turn against the rhs.
53 
54  return 0; // passed all the above comparison macros, must be equal.
55  }
56 
57  virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
58  {
60  return true;
61  }
62 
63  void setFactor(GLint factor);
64  inline GLint getFactor() const { return _factor; }
65 
66  void setPattern(GLushort pattern);
67  inline GLushort getPattern() const { return _pattern; }
68 
69  virtual void apply(State& state) const;
70 
71 
72  protected :
73 
74  virtual ~LineStipple();
75 
76  GLint _factor;
77  GLushort _pattern;
78 
79 };
80 
81 }
82 
83 #endif
#define OSG_EXPORT
Definition: Export.h:43
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
GLushort _pattern
Definition: LineStipple.h:77
virtual void usesMode(GLMode mode)=0
LineStipple(GLint factor, GLushort pattern)
Definition: LineStipple.h:31
#define GL_LINE_STIPPLE
Definition: LineStipple.h:20
#define META_StateAttribute(library, name, type)
LineStipple(const LineStipple &lw, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: LineStipple.h:36
GLushort getPattern() const
Definition: LineStipple.h:67
Definition: AlphaFunc.h:19
GLint getFactor() const
Definition: LineStipple.h:64
#define COMPARE_StateAttribute_Parameter(parameter)
virtual int compare(const StateAttribute &sa) const
Definition: LineStipple.h:44
virtual bool getModeUsage(StateAttribute::ModeUsage &usage) const
Definition: LineStipple.h:57