1 // The canvas for rendering with the 2d api
3 // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include <Instrumentation/od_gauge.hxx>
23 #include <simgear/props/props.hxx>
24 #include <osg/NodeCallback>
34 class CameraCullCallback;
36 public SGPropertyChangeListener
43 MISSING_SIZE_X = 0x0001,
44 MISSING_SIZE_Y = 0x0002,
45 CREATE_FAILED = 0x0004
51 void reset(SGPropertyNode* node);
52 void update(double delta_time_sec);
54 void setSizeX(int sx);
57 void setSizeY(int sy);
60 void setViewWidth(int w);
61 int getViewWidth() const;
63 void setViewHeight(int h);
64 int getViewHeight() const;
66 int getStatus() const;
67 const char* getStatusMsg() const;
69 virtual void childAdded( SGPropertyNode * parent,
70 SGPropertyNode * child );
71 virtual void childRemoved( SGPropertyNode * parent,
72 SGPropertyNode * child );
73 virtual void valueChanged (SGPropertyNode * node);
75 GLuint getTexId() const;
79 Canvas(const Canvas&); // = delete;
80 Canvas& operator=(const Canvas&); // = delete;
88 std::string _status_msg;
94 std::auto_ptr<canvas::Group> _root_group;
96 SGPropertyNode_ptr _node;
97 std::vector<SGPropertyNode_ptr> _color_background;
99 osg::ref_ptr<CameraCullCallback> _camera_callback;
100 osg::ref_ptr<osg::NodeCallback> _cull_callback;
102 bool _render_always; //<! Used to disable automatic lazy rendering (culling)
104 std::vector<SGPropertyNode*> _dirty_placements;
105 std::vector<Placements> _placements;
107 void setStatusFlags(unsigned int flags, bool set = true);
108 void clearPlacements(int index);
109 void clearPlacements();
114 #endif /* CANVAS_HXX_ */