2003-01-22 00:45:36 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
2002-08-19 23:14:10 +08:00
|
|
|
|
|
|
|
#ifndef OSG_CLEARNODE
|
|
|
|
#define OSG_CLEARNODE 1
|
|
|
|
|
|
|
|
#include <osg/Group>
|
|
|
|
#include <osg/Vec4>
|
|
|
|
|
|
|
|
namespace osg {
|
|
|
|
|
|
|
|
/** ClearNode is a Group node which controls the clearing of the color and depth
|
|
|
|
* buffers at the start of each frame.
|
|
|
|
* The earth sky by default is empty and simply holds the clear color of
|
|
|
|
* the background. However, if the uses wants to add their own clearing of
|
|
|
|
* the color and depth buffers then the children can be added, and the
|
|
|
|
* background clear turned off. The ClearNode by default has StateSet attached
|
|
|
|
* to it which sets the default ClearNode bin number to -1, so that all drawables
|
|
|
|
* below it are placed in a separate bin from the rest of the scene graph, and
|
|
|
|
* are rendered prior to standard opaque and transparent drawables.
|
|
|
|
*/
|
|
|
|
class SG_EXPORT ClearNode : public Group
|
|
|
|
{
|
|
|
|
public :
|
|
|
|
|
|
|
|
ClearNode();
|
|
|
|
|
|
|
|
ClearNode(const ClearNode& es, const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
|
|
|
Group(es,copyop),
|
|
|
|
_requiresClear(es._requiresClear),
|
|
|
|
_clearColor(es._clearColor) {}
|
|
|
|
|
|
|
|
|
|
|
|
META_Node(osg, ClearNode);
|
|
|
|
|
|
|
|
/** Sets the flag which control whether a glClear is required at the beginning of each frame. */
|
2002-09-02 20:31:35 +08:00
|
|
|
inline void setRequiresClear(bool requiresClear) { _requiresClear = requiresClear; }
|
2002-08-19 23:14:10 +08:00
|
|
|
|
|
|
|
/** Gets the flag which control whether a glClear is required at the beginning of each frame. */
|
2002-09-02 20:31:35 +08:00
|
|
|
inline bool getRequiresClear() const { return _requiresClear; }
|
2002-08-19 23:14:10 +08:00
|
|
|
|
|
|
|
/** Sets the clear color. */
|
|
|
|
inline void setClearColor(const Vec4& color) { _clearColor = color; }
|
|
|
|
|
|
|
|
/** Returns the clear color. */
|
|
|
|
inline const Vec4& getClearColor() const { return _clearColor; }
|
|
|
|
|
|
|
|
protected :
|
|
|
|
|
|
|
|
virtual ~ClearNode() {}
|
|
|
|
|
|
|
|
bool _requiresClear;
|
|
|
|
Vec4 _clearColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|