2 /// Placement for putting a canvas texture onto OpenSceneGraph objects.
4 /// It also provides a SGPickCallback for passing mouse events to the canvas and
5 /// manages emissive lighting of the placed canvas.
7 // Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Library General Public
11 // License as published by the Free Software Foundation; either
12 // version 2 of the License, or (at your option) any later version.
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Library General Public License for more details.
19 // You should have received a copy of the GNU Library General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #ifndef CANVAS_OBJECT_PLACEMENT_HXX_
24 #define CANVAS_OBJECT_PLACEMENT_HXX_
26 #include "CanvasPlacement.hxx"
27 #include "canvas_fwd.hxx"
29 #include <simgear/scene/util/SGSceneUserData.hxx>
30 #include <osg/Material>
38 * Place a Canvas onto an osg object (as texture).
40 class ObjectPlacement:
45 typedef osg::ref_ptr<osg::Group> GroupPtr;
46 typedef osg::ref_ptr<osg::Material> MaterialPtr;
48 ObjectPlacement( SGPropertyNode* node,
49 const GroupPtr& group,
50 const CanvasWeakPtr& canvas );
51 virtual ~ObjectPlacement();
54 * Set emissive lighting of the object the canvas is placed on.
56 void setEmission(float emit);
59 * Set whether pick events should be captured.
61 void setCaptureEvents(bool enable);
63 virtual bool childChanged(SGPropertyNode* child);
66 typedef SGSharedPtr<SGPickCallback> PickCallbackPtr;
67 typedef osg::ref_ptr<SGSceneUserData> SGSceneUserDataPtr;
70 MaterialPtr _material;
71 CanvasWeakPtr _canvas;
72 PickCallbackPtr _pick_cb;
73 SGSceneUserDataPtr _scene_user_data;
77 } // namespace simgear
79 #endif /* CANVAS_OBJECT_PLACEMENT_HXX_ */