Scribe
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.
*/
//osgFX - Copyright (C) 2003 Marco Jez
#ifndef OSGFX_SCRIBE_
#define OSGFX_SCRIBE_
#include <osgFX/Export>
#include <osgFX/Effect>
#include <osg/Material>
#include <osg/LineWidth>
namespace osgFX
{
class OSGFX_EXPORT Scribe: public Effect {
public:
Scribe();
Scribe(const Scribe& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
// effect class information
META_Effect(
osgFX,
Scribe,
"Scribe",
"This is a two-passes effect; the first pass renders the subgraph as usual "
"while the second pass switches to wireframe mode, sets up lighting and "
"material to obtain a fixed (user-defined) color and then renders the subgraph.\n"
"This effect uses the PolygonOffset attribute to avoid Z-fighting, so it "
"requires at least OpenGL version 1.1.",
"Marco Jez");
inline const osg::Vec4& getWireframeColor() const;
inline void setWireframeColor(const osg::Vec4& color);
inline float getWireframeLineWidth() const;
inline void setWireframeLineWidth(float w);
protected:
virtual ~Scribe() {}
Scribe& operator=(const Scribe&) { return *this; }
bool define_techniques();
private:
osg::ref_ptr<osg::Material> _wf_mat;
osg::ref_ptr<osg::LineWidth> _wf_lw;
};
// INLINE METHODS
inline const osg::Vec4& Scribe::getWireframeColor() const
{
return _wf_mat->getEmission(osg::Material::FRONT_AND_BACK);
}
inline void Scribe::setWireframeColor(const osg::Vec4& color)
{
_wf_mat->setEmission(osg::Material::FRONT_AND_BACK, color);
}
inline float Scribe::getWireframeLineWidth() const
{
return _wf_lw->getWidth();
}
inline void Scribe::setWireframeLineWidth(float w)
{
_wf_lw->setWidth(w);
}
}
#endif
Effect
LineWidth
Material
osgFX::Effect::Effect
Effect()
osgFX::Scribe::META_Effect
META_Effect(osgFX, Scribe, "Scribe", "This is a two-passes effect; the first pass renders the subgraph as usual " "while the second pass switches to wireframe mode, sets up lighting and " "material to obtain a fixed (user-defined) color and then renders the subgraph.\n" "This effect uses the PolygonOffset attribute to avoid Z-fighting, so it " "requires at least OpenGL version 1.1.", "Marco Jez")
osgFX::Scribe::setWireframeLineWidth
void setWireframeLineWidth(float w)
Definition Scribe:94
osgFX::Scribe::Scribe
Scribe(const Scribe &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgFX::Scribe::Scribe
Scribe()
osgFX::Scribe::getWireframeLineWidth
float getWireframeLineWidth() const
Definition Scribe:89
osgFX::Scribe::operator=
Scribe & operator=(const Scribe &)
Definition Scribe:68
osgFX::Scribe::~Scribe
virtual ~Scribe()
Definition Scribe:67
osgFX::Scribe::getWireframeColor
const osg::Vec4 & getWireframeColor() const
Definition Scribe:79
osgFX::Scribe::define_techniques
bool define_techniques()
osgFX::Scribe::setWireframeColor
void setWireframeColor(const osg::Vec4 &color)
Definition Scribe:84
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Material::FRONT_AND_BACK
@ FRONT_AND_BACK
Definition Material:102
osg::ref_ptr
Definition ref_ptr:32
osgFX
Definition AnisotropicLighting:25
osg::Vec4
Vec4f Vec4
Definition Vec4:21
Export
OSGFX_EXPORT
#define OSGFX_EXPORT
Definition osgFX/Export:27