本文整理汇总了C++中MeshInstance::set_material_override方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshInstance::set_material_override方法的具体用法?C++ MeshInstance::set_material_override怎么用?C++ MeshInstance::set_material_override使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshInstance
的用法示例。
在下文中一共展示了MeshInstance::set_material_override方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _notification
void NavigationMeshInstance::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
Spatial *c = this;
while (c) {
navigation = c->cast_to<Navigation>();
if (navigation) {
if (enabled && navmesh.is_valid()) {
nav_id = navigation->navmesh_create(navmesh, get_relative_transform(navigation), this);
}
break;
}
c = c->get_parent_spatial();
}
if (navmesh.is_valid() && get_tree()->is_debugging_navigation_hint()) {
MeshInstance *dm = memnew(MeshInstance);
dm->set_mesh(navmesh->get_debug_mesh());
if (is_enabled()) {
dm->set_material_override(get_tree()->get_debug_navigation_material());
} else {
dm->set_material_override(get_tree()->get_debug_navigation_disabled_material());
}
add_child(dm);
debug_view = dm;
}
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
if (navigation && nav_id != -1) {
navigation->navmesh_set_transform(nav_id, get_relative_transform(navigation));
}
} break;
case NOTIFICATION_EXIT_TREE: {
if (navigation) {
if (nav_id != -1) {
navigation->navmesh_remove(nav_id);
nav_id = -1;
}
}
if (debug_view) {
debug_view->queue_delete();
debug_view = NULL;
}
navigation = NULL;
} break;
}
}
示例2: set_enabled
void NavigationMeshInstance::set_enabled(bool p_enabled) {
if (enabled == p_enabled)
return;
enabled = p_enabled;
if (!is_inside_tree())
return;
if (!enabled) {
if (nav_id != -1) {
navigation->navmesh_remove(nav_id);
nav_id = -1;
}
} else {
if (navigation) {
if (navmesh.is_valid()) {
nav_id = navigation->navmesh_create(navmesh, get_relative_transform(navigation), this);
}
}
}
if (debug_view) {
MeshInstance *dm = debug_view->cast_to<MeshInstance>();
if (is_enabled()) {
dm->set_material_override(get_tree()->get_debug_navigation_material());
} else {
dm->set_material_override(get_tree()->get_debug_navigation_disabled_material());
}
}
update_gizmo();
}