|
|
@@ -312,6 +312,7 @@ void Node::interpolate(bool snapToEnd)
|
|
|
mScale = mInterpolationScale;
|
|
|
mInterpolationFlags = INTERP_NONE;
|
|
|
}
|
|
|
+
|
|
|
markDirty();
|
|
|
}
|
|
|
|
|
|
@@ -565,6 +566,15 @@ Node* Node::getChild(StringHash nameHash, bool recursive) const
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+void Node::markDirty()
|
|
|
+{
|
|
|
+ mDirty = true;
|
|
|
+ onMarkedDirty();
|
|
|
+
|
|
|
+ for (std::vector<SharedPtr<Node> >::iterator i = mChildren.begin(); i != mChildren.end(); ++i)
|
|
|
+ (*i)->markDirty();
|
|
|
+}
|
|
|
+
|
|
|
void Node::getNetTransform(Vector3& position, Quaternion& rotation, Vector3& scale, ComponentRef& parentRef, const NetUpdateInfo& info)
|
|
|
{
|
|
|
// Use the parent node only if it will be synced
|
|
|
@@ -586,14 +596,26 @@ void Node::getNetTransform(Vector3& position, Quaternion& rotation, Vector3& sca
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void Node::getChildrenRecursive(unsigned nodeFlags, std::vector<Node*>& dest) const
|
|
|
+void Node::updateWorldPosition()
|
|
|
{
|
|
|
- for (std::vector<SharedPtr<Node> >::const_iterator i = mChildren.begin(); i != mChildren.end(); ++i)
|
|
|
+ if (mParent)
|
|
|
{
|
|
|
- if ((*i)->mNodeFlags & nodeFlags)
|
|
|
- dest.push_back(*i);
|
|
|
- (*i)->getChildrenRecursive(nodeFlags, dest);
|
|
|
+ const Quaternion& parentRotation = mParent->getWorldRotation();
|
|
|
+ const Vector3& parentScale = mParent->getWorldScale();
|
|
|
+
|
|
|
+ mWorldPosition = mParent->getWorldPosition() + (parentRotation * (parentScale * mPosition));
|
|
|
+ mWorldRotation = parentRotation * mRotation;
|
|
|
+ mWorldScale = parentScale * mScale;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ mWorldPosition = mPosition;
|
|
|
+ mWorldRotation = mRotation;
|
|
|
+ mWorldScale = mScale;
|
|
|
}
|
|
|
+
|
|
|
+ mDirty = false;
|
|
|
+ mWorldTransformDirty = true;
|
|
|
}
|
|
|
|
|
|
void Node::removeChild(std::vector<SharedPtr<Node> >::iterator i, bool setWorldTransform, bool calledFromDestructor)
|
|
|
@@ -610,24 +632,12 @@ void Node::removeChild(std::vector<SharedPtr<Node> >::iterator i, bool setWorldT
|
|
|
mChildren.erase(i);
|
|
|
}
|
|
|
|
|
|
-void Node::updateWorldPosition()
|
|
|
+void Node::getChildrenRecursive(unsigned nodeFlags, std::vector<Node*>& dest) const
|
|
|
{
|
|
|
- if (mParent)
|
|
|
- {
|
|
|
- const Quaternion& parentRotation = mParent->getWorldRotation();
|
|
|
- const Vector3& parentScale = mParent->getWorldScale();
|
|
|
-
|
|
|
- mWorldPosition = mParent->getWorldPosition() + (parentRotation * (parentScale * mPosition));
|
|
|
- mWorldRotation = parentRotation * mRotation;
|
|
|
- mWorldScale = parentScale * mScale;
|
|
|
- }
|
|
|
- else
|
|
|
+ for (std::vector<SharedPtr<Node> >::const_iterator i = mChildren.begin(); i != mChildren.end(); ++i)
|
|
|
{
|
|
|
- mWorldPosition = mPosition;
|
|
|
- mWorldRotation = mRotation;
|
|
|
- mWorldScale = mScale;
|
|
|
+ if ((*i)->mNodeFlags & nodeFlags)
|
|
|
+ dest.push_back(*i);
|
|
|
+ (*i)->getChildrenRecursive(nodeFlags, dest);
|
|
|
}
|
|
|
-
|
|
|
- mDirty = false;
|
|
|
- mWorldTransformDirty = true;
|
|
|
}
|