PolygonMode
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 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.
*/
#ifndef OSG_POLYGONMODE
#define OSG_POLYGONMODE 1
#include <osg/StateAttribute>
#include <osg/GL>
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GLES3_AVAILABLE)
#define GL_POINT 0x1B00
#define GL_LINE 0x1B01
#define GL_FILL 0x1B02
#endif
namespace osg {
class OSG_EXPORT PolygonMode : public StateAttribute
{
public :
enum Mode {
POINT = GL_POINT,
LINE = GL_LINE,
FILL = GL_FILL
};
enum Face {
FRONT_AND_BACK,
FRONT,
BACK
};
PolygonMode();
PolygonMode(Face face,Mode mode);
PolygonMode(const PolygonMode& pm,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
StateAttribute(pm,copyop),
_modeFront(pm._modeFront),
_modeBack(pm._modeBack) {}
META_StateAttribute(osg, PolygonMode, POLYGONMODE);
virtual int compare(const StateAttribute& sa) const
{
// check the types are equal and then create the rhs variable
// used by the COMPARE_StateAttribute_Parameter macros below.
COMPARE_StateAttribute_Types(PolygonMode,sa)
// compare each parameter in turn against the rhs.
COMPARE_StateAttribute_Parameter(_modeFront)
COMPARE_StateAttribute_Parameter(_modeBack)
return 0; // passed all the above comparison macros, must be equal.
}
void setMode(Face face,Mode mode);
Mode getMode(Face face) const;
inline bool getFrontAndBack() const { return _modeFront==_modeBack; }
virtual void apply(State& state) const;
protected:
virtual ~PolygonMode();
Mode _modeFront;
Mode _modeBack;
};
}
#endif
StateAttribute
COMPARE_StateAttribute_Parameter
#define COMPARE_StateAttribute_Parameter(parameter)
Definition StateAttribute:69
COMPARE_StateAttribute_Types
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
Definition StateAttribute:57
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::PolygonMode::_modeBack
Mode _modeBack
Definition PolygonMode:84
osg::PolygonMode::PolygonMode
PolygonMode()
osg::PolygonMode::META_StateAttribute
META_StateAttribute(osg, PolygonMode, POLYGONMODE)
osg::PolygonMode::apply
virtual void apply(State &state) const
osg::PolygonMode::PolygonMode
PolygonMode(const PolygonMode &pm, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PolygonMode:51
osg::PolygonMode::setMode
void setMode(Face face, Mode mode)
osg::PolygonMode::_modeFront
Mode _modeFront
Definition PolygonMode:83
osg::PolygonMode::Face
Face
Definition PolygonMode:40
osg::PolygonMode::BACK
@ BACK
Definition PolygonMode:43
osg::PolygonMode::FRONT
@ FRONT
Definition PolygonMode:42
osg::PolygonMode::FRONT_AND_BACK
@ FRONT_AND_BACK
Definition PolygonMode:41
osg::PolygonMode::getFrontAndBack
bool getFrontAndBack() const
Definition PolygonMode:75
osg::PolygonMode::~PolygonMode
virtual ~PolygonMode()
osg::PolygonMode::Mode
Mode
Definition PolygonMode:34
osg::PolygonMode::FILL
@ FILL
Definition PolygonMode:37
osg::PolygonMode::LINE
@ LINE
Definition PolygonMode:36
osg::PolygonMode::POINT
@ POINT
Definition PolygonMode:35
osg::PolygonMode::PolygonMode
PolygonMode(Face face, Mode mode)
osg::PolygonMode::compare
virtual int compare(const StateAttribute &sa) const
Definition PolygonMode:59
osg::PolygonMode::getMode
Mode getMode(Face face) const
osg::StateAttribute::StateAttribute
StateAttribute()
osg::StateAttribute::POLYGONMODE
@ POLYGONMODE
Definition StateAttribute:127
osg::State
Definition State:80
osg
Definition AlphaFunc:19
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39