OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PolygonMode.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_POLYGONMODE
15 #define OSG_POLYGONMODE 1
16 
17 #include <osg/StateAttribute>
18 #include <osg/GL>
19 
20 #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
21  #define GL_POINT 0x1B00
22  #define GL_LINE 0x1B01
23  #define GL_FILL 0x1B02
24 #endif
25 
26 namespace osg {
27 
31 {
32  public :
33 
34  enum Mode {
35  POINT = GL_POINT,
36  LINE = GL_LINE,
37  FILL = GL_FILL
38  };
39 
40  enum Face {
43  BACK
44  };
45 
46  PolygonMode();
47 
48  PolygonMode(Face face,Mode mode);
49 
52  StateAttribute(pm,copyop),
53  _modeFront(pm._modeFront),
54  _modeBack(pm._modeBack) {}
55 
56  META_StateAttribute(osg, PolygonMode, POLYGONMODE);
57 
59  virtual int compare(const StateAttribute& sa) const
60  {
61  // check the types are equal and then create the rhs variable
62  // used by the COMPARE_StateAttribute_Parameter macros below.
64 
65  // compare each parameter in turn against the rhs.
68 
69  return 0; // passed all the above comparison macros, must be equal.
70  }
71 
72  void setMode(Face face,Mode mode);
73  Mode getMode(Face face) const;
74 
75  inline bool getFrontAndBack() const { return _modeFront==_modeBack; }
76 
77  virtual void apply(State& state) const;
78 
79  protected:
80 
81  virtual ~PolygonMode();
82 
85 
86 };
87 
88 }
89 
90 #endif
#define OSG_EXPORT
Definition: Export.h:43
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
PolygonMode(const PolygonMode &pm, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: PolygonMode.h:51
bool getFrontAndBack() const
Definition: PolygonMode.h:75
#define META_StateAttribute(library, name, type)
Definition: AlphaFunc.h:19
virtual int compare(const StateAttribute &sa) const
Definition: PolygonMode.h:59
#define COMPARE_StateAttribute_Parameter(parameter)