本文整理汇总了C++中Spatial::get_parent方法的典型用法代码示例。如果您正苦于以下问题:C++ Spatial::get_parent方法的具体用法?C++ Spatial::get_parent怎么用?C++ Spatial::get_parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spatial
的用法示例。
在下文中一共展示了Spatial::get_parent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _notification
void GridMap::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_WORLD: {
Spatial *c = this;
while (c) {
navigation = Object::cast_to<Navigation>(c);
if (navigation) {
break;
}
c = Object::cast_to<Spatial>(c->get_parent());
}
last_transform = get_global_transform();
for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) {
_octant_enter_world(E->key());
}
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
Transform new_xform = get_global_transform();
if (new_xform == last_transform)
break;
//update run
for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) {
_octant_transform(E->key());
}
last_transform = new_xform;
} break;
case NOTIFICATION_EXIT_WORLD: {
for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) {
_octant_exit_world(E->key());
}
navigation = NULL;
//_queue_octants_dirty(MAP_DIRTY_INSTANCES|MAP_DIRTY_TRANSFORMS);
//_update_octants_callback();
//_update_area_instances();
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
_update_visibility();
} break;
}
}
示例2: _notification
void GridMap::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_WORLD: {
_update_area_instances();
for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) {
//IndexKey ik;
//ik.key = E->key().indexkey;
_octant_enter_world(E->key());
_octant_update(E->key());
}
awaiting_update = false;
last_transform = get_global_transform();
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
Transform new_xform = get_global_transform();
if (new_xform == last_transform)
break;
//update run
for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) {
_octant_transform(E->key());
}
last_transform = new_xform;
} break;
case NOTIFICATION_EXIT_WORLD: {
for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) {
_octant_exit_world(E->key());
}
//_queue_dirty_map(MAP_DIRTY_INSTANCES|MAP_DIRTY_TRANSFORMS);
//_update_dirty_map_callback();
//_update_area_instances();
} break;
case NOTIFICATION_ENTER_TREE: {
Spatial *c = this;
while (c) {
navigation = c->cast_to<Navigation>();
if (navigation) {
break;
}
c = c->get_parent()->cast_to<Spatial>();
}
if (navigation) {
for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) {
if (navigation) {
_octant_enter_tree(E->key());
}
}
}
_queue_dirty_map();
} break;
case NOTIFICATION_EXIT_TREE: {
for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) {
if (navigation) {
_octant_clear_navmesh(E->key());
}
}
navigation = NULL;
} break;
}
}