1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2004 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_LINEWIDTH 1
17#include <osg/StateAttribute>
21/** LineWidth - encapsulates the OpenGL glLineWidth for setting the width of lines in pixels. */
22class OSG_EXPORT LineWidth : public StateAttribute
26 LineWidth(float width=1.0f);
28 /** Copy constructor using CopyOp to manage deep vs shallow copy. */
29 LineWidth(const LineWidth& lw,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
30 StateAttribute(lw,copyop),
33 META_StateAttribute(osg, LineWidth, LINEWIDTH);
35 /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
36 virtual int compare(const StateAttribute& sa) const
38 // check if the types are equal and then create the rhs variable
39 // used by the COMPARE_StateAttribute_Parameter macros below.
40 COMPARE_StateAttribute_Types(LineWidth,sa)
42 // compare each parameter in turn against the rhs.
43 COMPARE_StateAttribute_Parameter(_width)
45 return 0; // passed all the above comparison macros, must be equal.
48 void setWidth(float width);
50 inline float getWidth() const { return _width; }
52 virtual void apply(State& state) const;