Esempio n. 1
0
	void Transform2D::ValidateCleanliness()
	{
		Transform2D* lastDirty = nullptr;
		Transform2D* curNode = this;
		while (curNode)
		{
			if (curNode->GetIsDirty())
				lastDirty = curNode;
			curNode = curNode->m_node.GetParent();
		}
		if (lastDirty)
		{
			ValidateTransforms(lastDirty);
		}
	}
Esempio n. 2
0
	STATIC void Transform2D::ValidateTransforms(Transform2D* root)
	{
		Transform2D* curTransform = root;
		while (curTransform != NULL)
		{
			Hierarchy<Transform2D>& curNode = curTransform->m_node;

			// If this transform is dirty, then update the rest of it's hierarchy
			if (curTransform->GetIsDirty())
			{
				// We've got dirt on this transform; we know it's number... Update the transforms on downwards
				curTransform->UpdateHierarchy();
				// Traverse upward to continue our traversal
				while (nullptr != curTransform)
				{
					Hierarchy<Transform2D>& upwardNode = curTransform->m_node;

					// Check if there's a sibling of this node
					if (nullptr != upwardNode.GetSibling())
					{
						curTransform = upwardNode.GetSibling();
						break;
					}
					else
					{
						// If this is the root node, then it's time to leave
						if (root == curTransform)
						{
							curTransform = nullptr;
							break;
						}
						curTransform = upwardNode.GetParent();
					}
				}
			}
			else
			{
				curTransform = curNode.Next();
			}
		}
	}