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_FRONTFACE 1
17#include <osg/StateAttribute>
22/** Class to specify the orientation of front-facing polygons.
24class OSG_EXPORT FrontFace : public StateAttribute
30 COUNTER_CLOCKWISE = GL_CCW
33 FrontFace(Mode face=COUNTER_CLOCKWISE);
35 /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
36 FrontFace(const FrontFace& ff,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
37 StateAttribute(ff,copyop),
40 META_StateAttribute(osg, FrontFace, FRONTFACE);
42 /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
43 virtual int compare(const StateAttribute& sa) const
45 // check the types are equal and then create the rhs variable
46 // used by the COMPARE_StateAttribute_Parameter macros below.
47 COMPARE_StateAttribute_Types(FrontFace,sa)
49 // compare each parameter in turn against the rhs.
50 COMPARE_StateAttribute_Parameter(_mode)
52 return 0; // passed all the above comparison macros, must be equal.
55 inline void setMode(Mode mode) { _mode = mode; }
56 inline Mode getMode() const { return _mode; }
58 virtual void apply(State& state) const;