2 ******************************************************************************
5 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2016.
11 *****************************************************************************/
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "OSGNode.hpp"
30 #include "DirtySupport.hpp"
36 namespace osgQtQuick
{
39 struct OSGNode::Hidden
: public QObject
, public DirtySupport
{
47 osg::ref_ptr
<osg::Node
> node
;
52 Hidden(OSGNode
*self
) : QObject(self
), self(self
), complete(false) /*, dirty(0)*/
55 osg::Node
*nodeToUpdate() const
62 return self
->updateNode();
65 bool acceptNode(osg::Node
*aNode
)
87 OSGNode::OSGNode(QObject
*parent
) : QObject(parent
), QQmlParserStatus(), h(new Hidden(this))
95 osg::Node
*OSGNode::node() const
100 void OSGNode::setNode(osg::Node
*node
)
102 if (h
->acceptNode(node
)) {
107 bool OSGNode::isDirty(int mask
) const
109 return h
->isDirty(mask
);
112 void OSGNode::setDirty(int mask
)
117 void OSGNode::clearDirty()
122 osg::Node
*OSGNode::createNode()
127 void OSGNode::updateNode()
130 void OSGNode::emitNodeChanged()
133 emit
nodeChanged(node());
137 void OSGNode::classBegin()
139 // qDebug() << "OSGNode::classBegin" << this;
141 setNode(createNode());
144 void OSGNode::componentComplete()
146 // qDebug() << "OSGNode::componentComplete" << this;
151 if (!h
->node
.valid()) {
152 qWarning() << "OSGNode::componentComplete - node is not valid!" << this;
155 } // namespace osgQtQuick
157 #include "OSGNode.moc"