OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ClipControl.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_CLIPCONTROL
15 #define OSG_CLIPCONTROL 1
16 
17 #include <osg/StateAttribute>
18 
19 #ifndef GL_VERSION_4_5
20  #define GL_NEGATIVE_ONE_TO_ONE 0x935E
21  #define GL_ZERO_TO_ONE 0x935F
22 #endif
23 
24 namespace osg {
25 
29 {
30  public :
31 
32  enum Origin
33  {
34  LOWER_LEFT = GL_LOWER_LEFT,
35  UPPER_LEFT = GL_UPPER_LEFT
36  };
37 
38  enum DepthMode
39  {
40  NEGATIVE_ONE_TO_ONE = GL_NEGATIVE_ONE_TO_ONE,
41  ZERO_TO_ONE = GL_ZERO_TO_ONE
42  };
43 
44 
45  ClipControl(Origin origin=LOWER_LEFT, DepthMode depthMode=NEGATIVE_ONE_TO_ONE);
46 
48  ClipControl(const ClipControl& clipControl,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
49 
50 
51  META_StateAttribute(osg, ClipControl, CLIPCONTROL);
52 
54  virtual int compare(const StateAttribute& sa) const
55  {
56  // check the types are equal and then create the rhs variable
57  // used by the COMPARE_StateAttribute_Parameter macros below.
59 
60  // compare each parameter in turn against the rhs.
63 
64  return 0; // passed all the above comparison macros, must be equal.
65  }
66 
67  void setOrigin(Origin origin) { _origin = origin; }
68  Origin getOrigin() const { return _origin; }
69 
70  void setDepthMode(DepthMode depthMode) { _depthMode = depthMode; }
71  DepthMode getDepthMode() const { return _depthMode; }
72 
73  virtual void apply(State& state) const;
74 
75  protected:
76 
77  virtual ~ClipControl();
78 
81 };
82 
83 }
84 
85 #endif
#define GL_LOWER_LEFT
Definition: GLDefines.h:494
#define OSG_EXPORT
Definition: Export.h:43
DepthMode getDepthMode() const
Definition: ClipControl.h:71
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
virtual int compare(const StateAttribute &sa) const
Definition: ClipControl.h:54
#define GL_NEGATIVE_ONE_TO_ONE
Definition: ClipControl.h:20
#define GL_UPPER_LEFT
Definition: GLDefines.h:495
void setOrigin(Origin origin)
Definition: ClipControl.h:67
#define META_StateAttribute(library, name, type)
Origin getOrigin() const
Definition: ClipControl.h:68
Definition: AlphaFunc.h:19
#define COMPARE_StateAttribute_Parameter(parameter)
DepthMode _depthMode
Definition: ClipControl.h:80
#define GL_ZERO_TO_ONE
Definition: ClipControl.h:21
void setDepthMode(DepthMode depthMode)
Definition: ClipControl.h:70