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.
13//osgFX - Copyright (C) 2003 Marco Jez
18#include <osgFX/Export>
19#include <osgFX/Effect>
21#include <osg/Material>
22#include <osg/LineWidth>
28 This is a two-passes effect; the first pass renders the subgraph as usual
29 while the second pass switches to wireframe mode, sets up lighting and
30 material to obtain a fixed (user-defined) color and then renders the subgraph.
31 This effect uses the PolygonOffset attribute to avoid Z-fighting, so it
32 requires at least OpenGL version 1.1.
34 class OSGFX_EXPORT Scribe: public Effect {
37 Scribe(const Scribe& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
39 // effect class information
46 "This is a two-passes effect; the first pass renders the subgraph as usual "
47 "while the second pass switches to wireframe mode, sets up lighting and "
48 "material to obtain a fixed (user-defined) color and then renders the subgraph.\n"
49 "This effect uses the PolygonOffset attribute to avoid Z-fighting, so it "
50 "requires at least OpenGL version 1.1.",
54 /** get the wireframe color */
55 inline const osg::Vec4& getWireframeColor() const;
57 /** set the wireframe color */
58 inline void setWireframeColor(const osg::Vec4& color);
60 /** get the wireframe line width */
61 inline float getWireframeLineWidth() const;
63 /** set the wireframe line width */
64 inline void setWireframeLineWidth(float w);
68 Scribe& operator=(const Scribe&) { return *this; }
70 bool define_techniques();
73 osg::ref_ptr<osg::Material> _wf_mat;
74 osg::ref_ptr<osg::LineWidth> _wf_lw;
79 inline const osg::Vec4& Scribe::getWireframeColor() const
81 return _wf_mat->getEmission(osg::Material::FRONT_AND_BACK);
84 inline void Scribe::setWireframeColor(const osg::Vec4& color)
86 _wf_mat->setEmission(osg::Material::FRONT_AND_BACK, color);
89 inline float Scribe::getWireframeLineWidth() const
91 return _wf_lw->getWidth();
94 inline void Scribe::setWireframeLineWidth(float w)