1 // Canvas placement for placing a canvas texture onto osg objects.
3 // It also provides a SGPickCallback for passing mouse events to the canvas and
4 // manages emissive lighting of the placed canvas.
6 // Copyright (C) 2013 Thomas Geymayer <tomgey@gmail.com>
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #ifndef CANVAS_PICK_PLACEMENT_HXX_
23 #define CANVAS_OBJECT_PLACEMENT_HXX_
25 #include "CanvasPlacement.hxx"
26 #include "canvas_fwd.hxx"
28 #include <simgear/scene/util/SGSceneUserData.hxx>
29 #include <osg/Material>
36 class ObjectPlacement:
41 typedef osg::ref_ptr<osg::Group> GroupPtr;
42 typedef osg::ref_ptr<osg::Material> MaterialPtr;
44 ObjectPlacement( SGPropertyNode* node,
45 const GroupPtr& group,
46 const CanvasWeakPtr& canvas );
47 virtual ~ObjectPlacement();
50 * Set emissive lighting of the object the canvas is placed on.
52 void setEmission(float emit);
55 * Set whether pick events should be captured.
57 void setCaptureEvents(bool enable);
59 virtual bool childChanged(SGPropertyNode* child);
62 typedef SGSharedPtr<SGPickCallback> PickCallbackPtr;
63 typedef osg::ref_ptr<SGSceneUserData> SGSceneUserDataPtr;
66 MaterialPtr _material;
67 CanvasWeakPtr _canvas;
68 PickCallbackPtr _pick_cb;
69 SGSceneUserDataPtr _scene_user_data;
73 } // namespace simgear
75 #endif /* CANVAS_PICK_PLACEMENT_HXX_ */