root/OpenSceneGraph/trunk/include/osgFX/Scribe @ 13041

Revision 13041, 3.0 kB (checked in by robert, 3 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
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.
7 *
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.
12*/
13//osgFX - Copyright (C) 2003 Marco Jez
14
15#ifndef OSGFX_SCRIBE_
16#define OSGFX_SCRIBE_
17
18#include <osgFX/Export>
19#include <osgFX/Effect>
20
21#include <osg/Material>
22#include <osg/LineWidth>
23
24namespace osgFX
25{
26
27    /**
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.
33    */
34    class OSGFX_EXPORT Scribe: public Effect {
35    public:
36        Scribe();
37        Scribe(const Scribe& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
38
39        // effect class informations
40        META_Effect(
41            osgFX,
42            Scribe,
43
44            "Scribe",
45
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.",
51
52            "Marco Jez");
53
54        /** get the wireframe color */
55        inline const osg::Vec4& getWireframeColor() const;
56
57        /** set the wireframe color */
58        inline void setWireframeColor(const osg::Vec4& color);
59
60        /** get the wireframe line width */
61        inline float getWireframeLineWidth() const;
62
63        /** set the wireframe line width */
64        inline void setWireframeLineWidth(float w);
65
66    protected:
67        virtual ~Scribe() {}
68        Scribe& operator=(const Scribe&) { return *this; }
69
70        bool define_techniques();
71
72    private:
73        osg::ref_ptr<osg::Material> _wf_mat;
74        osg::ref_ptr<osg::LineWidth> _wf_lw;
75    };
76
77    // INLINE METHODS
78
79    inline const osg::Vec4& Scribe::getWireframeColor() const
80    {
81        return _wf_mat->getEmission(osg::Material::FRONT_AND_BACK);
82    }
83
84    inline void Scribe::setWireframeColor(const osg::Vec4& color)
85    {
86        _wf_mat->setEmission(osg::Material::FRONT_AND_BACK, color);
87    }
88
89    inline float Scribe::getWireframeLineWidth() const
90    {
91        return _wf_lw->getWidth();
92    }
93
94    inline void Scribe::setWireframeLineWidth(float w)
95    {
96        _wf_lw->setWidth(w);
97    }
98
99}
100
101#endif
Note: See TracBrowser for help on using the browser.