本文整理汇总了C++中PNode::get方法的典型用法代码示例。如果您正苦于以下问题:C++ PNode::get方法的具体用法?C++ PNode::get怎么用?C++ PNode::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PNode
的用法示例。
在下文中一共展示了PNode::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveChild
void Node::RemoveChild(Node* node)
{
int idx = 0;
for (auto& child : children_)
{
if (child.get() == node)
{
children_.erase(children_.begin() + idx);
auto range = childrenHash_.equal_range(node->name_);
auto it = range.first;
while (it != range.second)
{
PNode child = it->second.lock();
if (!child)
it = childrenHash_.erase(it);
else if (child.get() == node)
it = childrenHash_.erase(it);
else
++it;
}
break;
}
++idx;
}
}
示例2: AddChild
void Node::AddChild(PNode node)
{
CHECK_ASSERT(node && node.get() != this);
children_.push_back(node);
childrenHash_.insert(std::make_pair(node->name_, node));
PNode thisNode = SharedFromPointerNode(this);
node->parent_ = thisNode;
PScene scene = scene_.lock();
if (!scene) scene = std::dynamic_pointer_cast<Scene>(thisNode);
node->scene_ = scene;
if (scene)
{
PLight light = std::dynamic_pointer_cast<Light>(node);
if (light)
scene->AddLight(light.get());
else
{
PCamera camera = std::dynamic_pointer_cast<Camera>(node);
if (camera) scene->AddCamera(camera.get());
else
{
auto ps = std::dynamic_pointer_cast<ParticleSystem>(node);
if (ps) scene->AddParticleSystem(ps.get());
}
}
}
node->MarkAsDirty();
}