1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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.
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.
15#define OSG_CLEARNODE 1
22/** A Group node for clearing the color and depth buffers. Use setClearColor
23 * to change the clear color, and setRequiresClear to disable/enable the call
24 * clearing. You might want to disable clearing if you perform your clear by
25 * drawing fullscreen geometry. If you do this, add child nodes to perform
26 * such drawing. The default StateSet associated with this node places
27 * children in render bin -1 to ensure that children are rendered prior to
28 * the rest of the scene graph.
30class OSG_EXPORT ClearNode : public Group
36 ClearNode(const ClearNode& cs, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
38 _requiresClear(cs._requiresClear),
39 _clearColor(cs._clearColor),
40 _clearMask(cs._clearMask) {}
43 META_Node(osg, ClearNode);
45 /** Enable/disable clearing via glClear. */
46 inline void setRequiresClear(bool requiresClear) { _requiresClear = requiresClear; }
48 /** Gets whether clearing is enabled or disabled. */
49 inline bool getRequiresClear() const { return _requiresClear; }
51 /** Sets the clear color. */
52 inline void setClearColor(const Vec4& color) { _clearColor = color; }
54 /** Returns the clear color. */
55 inline const Vec4& getClearColor() const { return _clearColor; }
57 /** Set the clear mask used in glClear(..).
58 * Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT. */
59 inline void setClearMask(GLbitfield mask) { _clearMask = mask; }
61 /** Get the clear mask.*/
62 inline GLbitfield getClearMask() const { return _clearMask; }
66 virtual ~ClearNode() {}
70 GLbitfield _clearMask;