OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Cartoon.h
Go to the documentation of this file.
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_CARTOON_
16 #define OSGFX_CARTOON_
17 
18 #include <osgFX/Export>
19 #include <osgFX/Effect>
20 
21 #include <osg/Material>
22 #include <osg/LineWidth>
23 
24 namespace osgFX
25 {
26 
35  class OSGFX_EXPORT Cartoon: public Effect {
36  public:
37  Cartoon();
38  Cartoon(const Cartoon& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
39 
40  // effect class informations
42  osgFX,
43  Cartoon,
44 
45  "Cartoon",
46 
47  "This effect implements a technique called 'Cel-Shading' to produce a "
48  "cartoon-style (non photorealistic) rendering. Two passes are required: "
49  "the first one draws solid surfaces, the second one draws the outlines. "
50  "A vertex program is used to setup texture coordinates for a sharp lighting "
51  "texture on unit 0 which is generated on-the-fly.\n"
52  "This effect requires the ARB_vertex_program extension "
53  "or OpenGL Shading Language.",
54 
55  "Marco Jez; OGLSL port by Mike Weiblen");
56 
58  inline const osg::Vec4& getOutlineColor() const;
59 
61  inline void setOutlineColor(const osg::Vec4& color);
62 
64  inline float getOutlineLineWidth() const;
65 
67  inline void setOutlineLineWidth(float w);
68 
70  inline int getLightNumber() const;
71 
73  inline void setLightNumber(int n);
74 
75  protected:
76  virtual ~Cartoon() {}
77  Cartoon& operator=(const Cartoon&) { return *this; }
78 
79  bool define_techniques();
80 
81  private:
84  int _lightnum;
85  };
86 
87  // INLINE METHODS
88 
89  inline const osg::Vec4& Cartoon::getOutlineColor() const
90  {
92  }
93 
94  inline void Cartoon::setOutlineColor(const osg::Vec4& color)
95  {
97  }
98 
99  inline float Cartoon::getOutlineLineWidth() const
100  {
101  return _wf_lw->getWidth();
102  }
103 
104  inline void Cartoon::setOutlineLineWidth(float w)
105  {
106  _wf_lw->setWidth(w);
107  }
108 
109  inline int Cartoon::getLightNumber() const
110  {
111  return _lightnum;
112  }
113 
114  inline void Cartoon::setLightNumber(int n)
115  {
116  _lightnum = n;
117  dirtyTechniques();
118  }
119 
120 }
121 
122 #endif
float getOutlineLineWidth() const
Definition: Cartoon.h:99
void setOutlineColor(const osg::Vec4 &color)
Definition: Cartoon.h:94
int getLightNumber() const
Definition: Cartoon.h:109
float getWidth() const
Definition: LineWidth.h:50
#define META_Effect(library, classname, effectname, effectdescription, effectauthor)
Definition: Effect.h:35
void setLightNumber(int n)
Definition: Cartoon.h:114
void setEmission(Face face, const Vec4 &emission)
const Vec4 & getEmission(Face face) const
void dirtyTechniques()
Definition: Effect.h:204
#define OSGFX_EXPORT
Definition: Export.h:27
void setWidth(float width)
virtual ~Cartoon()
Definition: Cartoon.h:76
void setOutlineLineWidth(float w)
Definition: Cartoon.h:104
const osg::Vec4 & getOutlineColor() const
Definition: Cartoon.h:89
Cartoon & operator=(const Cartoon &)
Definition: Cartoon.h:77