OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CullFace.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_CULLFACE
15 #define OSG_CULLFACE 1
16 
17 #include <osg/GL>
18 #include <osg/StateAttribute>
19 
20 namespace osg {
21 
25 {
26  public :
27 
28  enum Mode {
29  FRONT = GL_FRONT,
30  BACK = GL_BACK,
31  FRONT_AND_BACK = GL_FRONT_AND_BACK
32  };
33 
34  CullFace(Mode mode=BACK):
35  _mode(mode) {}
36 
38  CullFace(const CullFace& cf,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
39  StateAttribute(cf,copyop),
40  _mode(cf._mode) {}
41 
42  META_StateAttribute(osg, CullFace, CULLFACE);
43 
45  virtual int compare(const StateAttribute& sa) const
46  {
47  // check the types are equal and then create the rhs variable
48  // used by the COMPARE_StateAttribute_Parameter macros below.
50 
51  // 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  {
59  usage.usesMode(GL_CULL_FACE);
60  return true;
61  }
62 
63  inline void setMode(Mode mode) { _mode = mode; }
64 
65  inline Mode getMode() const { return _mode; }
66 
67  virtual void apply(State& state) const;
68 
69  protected:
70 
71  virtual ~CullFace();
72 
74 
75 };
76 
77 }
78 
79 #endif
#define OSG_EXPORT
Definition: Export.h:43
virtual int compare(const StateAttribute &sa) const
Definition: CullFace.h:45
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
virtual void usesMode(GLMode mode)=0
void setMode(Mode mode)
Definition: CullFace.h:63
Mode _mode
Definition: CullFace.h:73
#define META_StateAttribute(library, name, type)
Definition: AlphaFunc.h:19
CullFace(Mode mode=BACK)
Definition: CullFace.h:34
Mode getMode() const
Definition: CullFace.h:65
#define COMPARE_StateAttribute_Parameter(parameter)
CullFace(const CullFace &cf, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: CullFace.h:38
virtual bool getModeUsage(StateAttribute::ModeUsage &usage) const
Definition: CullFace.h:57