本文整理汇总了C++中Viewport::DisableWorldAdditions方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewport::DisableWorldAdditions方法的具体用法?C++ Viewport::DisableWorldAdditions怎么用?C++ Viewport::DisableWorldAdditions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Viewport
的用法示例。
在下文中一共展示了Viewport::DisableWorldAdditions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateState
/** Update the state of the path build process. */
void PathBuildManager::UpdateState()
{
Viewport *vp = GetViewport();
if (this->state == PBS_IDLE || this->state == PBS_SINGLE) {
DisableWorldAdditions();
this->selected_arrow = INVALID_EDGE;
this->selected_slope = this->state == PBS_IDLE ? TSL_INVALID : TSL_FLAT;
}
/* The tile cursor is controlled by the viewport if waiting for a voxel or earlier. */
if (vp != nullptr && this->state > PBS_WAIT_VOXEL && this->state <= PBS_WAIT_BUY) {
vp->tile_cursor.SetCursor(this->pos, CUR_TYPE_TILE);
}
/* See whether the PBS_WAIT_ARROW state can be left automatically. */
if (this->state == PBS_WAIT_ARROW) {
this->allowed_arrows = GetPathAttachPoints(this->pos);
/* If a valid selection has been made, or if only one choice exists, take it. */
if (this->selected_arrow != INVALID_EDGE && ((0x11 << this->selected_arrow) & this->allowed_arrows) != 0) {
this->state = PBS_WAIT_SLOPE;
} else if (this->allowed_arrows == (1 << EDGE_NE) || this->allowed_arrows == (0x10 << EDGE_NE)) {
this->selected_arrow = EDGE_NE;
this->state = PBS_WAIT_SLOPE;
} else if (this->allowed_arrows == (1 << EDGE_NW) || this->allowed_arrows == (0x10 << EDGE_NW)) {
this->selected_arrow = EDGE_NW;
this->state = PBS_WAIT_SLOPE;
} else if (this->allowed_arrows == (1 << EDGE_SE) || this->allowed_arrows == (0x10 << EDGE_SE)) {
this->selected_arrow = EDGE_SE;
this->state = PBS_WAIT_SLOPE;
} else if (this->allowed_arrows == (1 << EDGE_SW) || this->allowed_arrows == (0x10 << EDGE_SW)) {
this->selected_arrow = EDGE_SW;
this->state = PBS_WAIT_SLOPE;
}
}
/* Set the arrow cursor. Note that display is controlled later. */
if (vp != nullptr) {
if (this->state > PBS_WAIT_ARROW && this->state <= PBS_WAIT_BUY) {
XYZPoint16 arrow_pos = this->ComputeArrowCursorPosition();
vp->arrow_cursor.SetCursor(arrow_pos, (CursorType)(CUR_TYPE_ARROW_NE + this->selected_arrow));
} else {
vp->arrow_cursor.SetInvalid();
}
}
/* See whether the PBS_WAIT_SLOPE state can be left automatically. */
if (this->state == PBS_WAIT_SLOPE) {
/* Compute allowed slopes. */
XYZPoint16 arrow_pos = this->ComputeArrowCursorPosition();
this->allowed_slopes = CanBuildPathFromEdge(arrow_pos, (TileEdge)((this->selected_arrow + 2) % 4));
/* If a valid selection has been made, or if only one choice exists, take it. */
if (this->selected_slope != TSL_INVALID && ((1 << this->selected_slope) & this->allowed_slopes) != 0) {
this->state = PBS_WAIT_BUY;
} else if (this->allowed_slopes == (1 << TSL_DOWN)) {
this->selected_slope = TSL_DOWN;
this->state = PBS_WAIT_BUY;
} else if (this->allowed_slopes == (1 << TSL_FLAT)) {
this->selected_slope = TSL_FLAT;
this->state = PBS_WAIT_BUY;
} else if (this->allowed_slopes == (1 << TSL_UP)) {
this->selected_slope = TSL_UP;
this->state = PBS_WAIT_BUY;
}
}
/* Handle _additions display. */
if (vp != nullptr) {
if (this->state == PBS_SINGLE || this->state == PBS_WAIT_SLOPE) {
_additions.Clear();
vp->EnableWorldAdditions();
} else if (this->state == PBS_WAIT_BUY) {
_additions.Clear();
this->ComputeWorldAdditions();
vp->EnableWorldAdditions();
vp->EnsureAdditionsAreVisible();
} else {
if (this->state != PBS_LONG_BUILD && this->state != PBS_LONG_BUY) vp->DisableWorldAdditions();
}
}
NotifyChange(WC_PATH_BUILDER, ALL_WINDOWS_OF_TYPE, CHG_UPDATE_BUTTONS, 0);
}