OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ClipNode.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_CLIPNODE
15 #define OSG_CLIPNODE 1
16 
17 #include <osg/Group>
18 #include <osg/ClipPlane>
19 
20 namespace osg {
21 
23 class OSG_EXPORT ClipNode : public Group
24 {
25 
26  public:
27 
28  typedef std::vector<ref_ptr<ClipPlane> > ClipPlaneList;
29 
30 
31  ClipNode();
32 
33  ClipNode(const ClipNode& es, const CopyOp& copyop=CopyOp::SHALLOW_COPY);
34 
36 
38  {
40  ABSOLUTE_RF
41  };
42 
54  void setReferenceFrame(ReferenceFrame rf);
55 
56  ReferenceFrame getReferenceFrame() const { return _referenceFrame; }
57 
58 
60  void createClipBox(const BoundingBox& bb,unsigned int clipPlaneNumberBase=0);
61 
64  bool addClipPlane(ClipPlane* clipplane);
65 
68  bool removeClipPlane(ClipPlane* clipplane);
69 
72  bool removeClipPlane(unsigned int pos);
73 
75  inline unsigned int getNumClipPlanes() const { return _planes.size(); }
76 
77 
79  inline ClipPlane* getClipPlane(unsigned int pos) { return _planes[pos].get(); }
80 
82  inline const ClipPlane* getClipPlane(unsigned int pos) const { return _planes[pos].get(); }
83 
85  inline void setClipPlaneList(const ClipPlaneList& cpl) { _planes=cpl; }
86 
88  inline ClipPlaneList& getClipPlaneList() { return _planes; }
89 
91  inline const ClipPlaneList& getClipPlaneList() const { return _planes; }
92 
94  void setStateSetModes(StateSet&,StateAttribute::GLModeValue) const;
95 
97  void setLocalStateSetModes(StateAttribute::GLModeValue=StateAttribute::ON);
98 
99  virtual BoundingSphere computeBound() const;
100 
101  protected:
102 
103  virtual ~ClipNode();
104 
106  ClipPlaneList _planes;
107 
109 };
110 
111 }
112 
113 #endif
#define OSG_EXPORT
Definition: Export.h:43
const ClipPlane * getClipPlane(unsigned int pos) const
Definition: ClipNode.h:82
unsigned int getNumClipPlanes() const
Definition: ClipNode.h:75
ClipPlaneList _planes
Definition: ClipNode.h:106
ClipPlaneList & getClipPlaneList()
Definition: ClipNode.h:88
#define META_Node(library, name)
Definition: Node.h:59
ClipPlane * getClipPlane(unsigned int pos)
Definition: ClipNode.h:79
StateAttribute::GLModeValue _value
Definition: ClipNode.h:105
unsigned int GLModeValue
void setClipPlaneList(const ClipPlaneList &cpl)
Definition: ClipNode.h:85
const ClipPlaneList & getClipPlaneList() const
Definition: ClipNode.h:91
ReferenceFrame _referenceFrame
Definition: ClipNode.h:108
ReferenceFrame getReferenceFrame() const
Definition: ClipNode.h:56
Definition: AlphaFunc.h:19
std::vector< ref_ptr< ClipPlane > > ClipPlaneList
Definition: ClipNode.h:28