OpenSceneGraph 3.6.5
Cartoon
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
24namespace osgFX
25{
26
35 class OSGFX_EXPORT Cartoon: public Effect {
36 public:
39
40 // effect class information
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
80
81 private:
84 int _lightnum;
85 };
86
87 // INLINE METHODS
88
89 inline const osg::Vec4& Cartoon::getOutlineColor() const
90 {
91 return _wf_mat->getEmission(osg::Material::FRONT_AND_BACK);
92 }
93
94 inline void Cartoon::setOutlineColor(const osg::Vec4& color)
95 {
96 _wf_mat->setEmission(osg::Material::FRONT_AND_BACK, color);
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;
118 }
119
120}
121
122#endif
Vec4f Vec4
Definition Vec4:21
The osgFX library is a NodeKit that extends the core scene graph to provide a special effects framewo...
Definition AnisotropicLighting:25
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
@ FRONT_AND_BACK
Definition Material:102
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
int getLightNumber() const
get the OpenGL light number
Definition Cartoon:109
void setLightNumber(int n)
set the OpenGL light number that will be used in lighting computations
Definition Cartoon:114
void setOutlineColor(const osg::Vec4 &color)
set the outline color
Definition Cartoon:94
META_Effect(osgFX, Cartoon, "Cartoon", "This effect implements a technique called 'Cel-Shading' to produce a " "cartoon-style (non photorealistic) rendering. Two passes are required: " "the first one draws solid surfaces, the second one draws the outlines. " "A vertex program is used to setup texture coordinates for a sharp lighting " "texture on unit 0 which is generated on-the-fly.\n" "This effect requires the ARB_vertex_program extension " "or OpenGL Shading Language.", "Marco Jez; OGLSL port by Mike Weiblen")
const osg::Vec4 & getOutlineColor() const
get the outline color
Definition Cartoon:89
Cartoon & operator=(const Cartoon &)
Definition Cartoon:77
void setOutlineLineWidth(float w)
set the outline line width
Definition Cartoon:104
Cartoon(const Cartoon &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
float getOutlineLineWidth() const
get the outline line width
Definition Cartoon:99
virtual ~Cartoon()
Definition Cartoon:76
bool define_techniques()
abstract method to be implemented in derived classes; its purpose if to create the techniques that ca...
void dirtyTechniques()
force rebuilding of techniques on next traversal
Definition Effect:207
#define OSGFX_EXPORT
Definition Export:27

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.