openscenegraph
ShapeDrawable
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
14#ifndef OSG_SHAPEDRAWABLE
15#define OSG_SHAPEDRAWABLE 1
16
17#include <osg/Geometry>
18
19namespace osg {
20
21
30{
31 public:
32
34
36
37 template<class T> ShapeDrawable(const ref_ptr<T>& shape, TessellationHints* hints=0):
38 _tessellationHints(hints) { setShape(shape.get()); }
39
41 ShapeDrawable(const ShapeDrawable& pg,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
42
43 virtual Object* cloneType() const { return new ShapeDrawable(); }
44 virtual Object* clone(const CopyOp& copyop) const { return new ShapeDrawable(*this,copyop); }
45 virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ShapeDrawable*>(obj)!=NULL; }
46 virtual const char* libraryName() const { return "osg"; }
47 virtual const char* className() const { return "ShapeDrawable"; }
48
49 virtual void setShape(Shape* shape);
50
52 void setColor(const Vec4& color);
53
55 const Vec4& getColor() const { return _color; }
56
58
59 TessellationHints* getTessellationHints() { return _tessellationHints.get(); }
60 const TessellationHints* getTessellationHints() const { return _tessellationHints.get(); }
61
63 void build();
64
65 protected:
66
67 ShapeDrawable& operator = (const ShapeDrawable&) { return *this;}
68
69 virtual ~ShapeDrawable();
70
72
74
75};
76
77
78}
79
80#endif
Definition CopyOp:41
Definition Geometry:31
Definition Object:61
Definition ShapeDrawable:30
TessellationHints * getTessellationHints()
Definition ShapeDrawable:59
virtual bool isSameKindAs(const Object *obj) const
Definition ShapeDrawable:45
void setTessellationHints(TessellationHints *hints)
ref_ptr< TessellationHints > _tessellationHints
Definition ShapeDrawable:73
virtual Object * cloneType() const
Definition ShapeDrawable:43
const Vec4 & getColor() const
Definition ShapeDrawable:55
virtual Object * clone(const CopyOp &copyop) const
Definition ShapeDrawable:44
ShapeDrawable(Shape *shape, TessellationHints *hints=0)
void setColor(const Vec4 &color)
ShapeDrawable(const ShapeDrawable &pg, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Vec4 _color
Definition ShapeDrawable:71
const TessellationHints * getTessellationHints() const
Definition ShapeDrawable:60
virtual const char * className() const
Definition ShapeDrawable:47
virtual ~ShapeDrawable()
ShapeDrawable(const ref_ptr< T > &shape, TessellationHints *hints=0)
Definition ShapeDrawable:37
virtual const char * libraryName() const
Definition ShapeDrawable:46
virtual void setShape(Shape *shape)
Definition Shape:49
Definition Shape:658
Definition Vec4f:28
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
#define NULL
Definition osg/Export:55
#define OSG_EXPORT
Definition osg/Export:39