OpenSceneGraph 3.6.5
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
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
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
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Vec4f Vec4
Definition Vec4:21
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
Definition Geometry:31
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
Base class for all shape types.
Definition Shape:49
Describe several hints that can be passed to a Tessellator (like the one used by ShapeDrawable) as a ...
Definition Shape:658
TessellationHints * getTessellationHints()
Definition ShapeDrawable:59
virtual bool isSameKindAs(const Object *obj) const
return true if this and obj are of the same kind of object.
Definition ShapeDrawable:45
void setTessellationHints(TessellationHints *hints)
ref_ptr< TessellationHints > _tessellationHints
Definition ShapeDrawable:73
void build()
method to invoke to rebuild the geometry that renders the shape.
virtual Object * cloneType() const
clone an object of the same type as the node.
Definition ShapeDrawable:43
const Vec4 & getColor() const
Get the color of the shape.
Definition ShapeDrawable:55
virtual Object * clone(const CopyOp &copyop) const
return a clone of a node, with Object* return type.
Definition ShapeDrawable:44
ShapeDrawable(Shape *shape, TessellationHints *hints=0)
void setColor(const Vec4 &color)
Set the color of the shape.
ShapeDrawable(const ShapeDrawable &pg, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Vec4 _color
Definition ShapeDrawable:71
const TessellationHints * getTessellationHints() const
Definition ShapeDrawable:60
virtual const char * className() const
return the name of the node's class type.
Definition ShapeDrawable:47
virtual ~ShapeDrawable()
ShapeDrawable(const ref_ptr< T > &shape, TessellationHints *hints=0)
Definition ShapeDrawable:37
virtual const char * libraryName() const
return the name of the node's library.
Definition ShapeDrawable:46
virtual void setShape(Shape *shape)
Set the Shape of the Drawable.
#define NULL
Definition Export:55
#define OSG_EXPORT
Definition Export:39

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