本文整理汇总了C++中Basis::set_orthogonal_index方法的典型用法代码示例。如果您正苦于以下问题:C++ Basis::set_orthogonal_index方法的具体用法?C++ Basis::set_orthogonal_index怎么用?C++ Basis::set_orthogonal_index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Basis
的用法示例。
在下文中一共展示了Basis::set_orthogonal_index方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _update_duplicate_indicator
void GridMapEditor::_update_duplicate_indicator() {
if (!selection.active || input_action!=INPUT_DUPLICATE) {
Transform xf;
xf.basis.set_zero();
VisualServer::get_singleton()->instance_set_transform(duplicate_instance,xf);
return;
}
Transform xf;
xf.scale(Vector3(1,1,1)*(Vector3(1,1,1)+(selection.end-selection.begin))*node->get_cell_size());
xf.origin=(selection.begin+(selection.current-selection.click))*node->get_cell_size();
Basis rot;
rot.set_orthogonal_index(selection.duplicate_rot);
xf.basis = rot * xf.basis;
VisualServer::get_singleton()->instance_set_transform(duplicate_instance,node->get_global_transform() * xf);
}
示例2: _menu_option
void GridMapEditor::_menu_option(int p_option) {
switch(p_option) {
case MENU_OPTION_CONFIGURE: {
} break;
case MENU_OPTION_LOCK_VIEW: {
int index=options->get_popup()->get_item_index(MENU_OPTION_LOCK_VIEW);
lock_view=!options->get_popup()->is_item_checked(index);
options->get_popup()->set_item_checked(index,lock_view);
} break;
case MENU_OPTION_CLIP_DISABLED:
case MENU_OPTION_CLIP_ABOVE:
case MENU_OPTION_CLIP_BELOW: {
clip_mode=ClipMode(p_option-MENU_OPTION_CLIP_DISABLED);
for(int i=0;i<3;i++) {
int index=options->get_popup()->get_item_index(MENU_OPTION_CLIP_DISABLED+i);
options->get_popup()->set_item_checked(index,i==clip_mode);
}
_update_clip();
} break;
case MENU_OPTION_X_AXIS:
case MENU_OPTION_Y_AXIS:
case MENU_OPTION_Z_AXIS: {
int new_axis = p_option-MENU_OPTION_X_AXIS;
for(int i=0;i<3;i++) {
int idx=options->get_popup()->get_item_index(MENU_OPTION_X_AXIS+i);
options->get_popup()->set_item_checked(idx,i==new_axis);
}
edit_axis=Vector3::Axis(new_axis);
update_grid();
_update_clip();
} break;
case MENU_OPTION_CURSOR_ROTATE_Y: {
Basis r;
if (input_action==INPUT_DUPLICATE) {
r.set_orthogonal_index(selection.duplicate_rot);
r.rotate(Vector3(0,1,0),-Math_PI/2.0);
selection.duplicate_rot=r.get_orthogonal_index();
_update_duplicate_indicator();
break;
}
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0,1,0),-Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_ROTATE_X: {
Basis r;
if (input_action==INPUT_DUPLICATE) {
r.set_orthogonal_index(selection.duplicate_rot);
r.rotate(Vector3(1,0,0),-Math_PI/2.0);
selection.duplicate_rot=r.get_orthogonal_index();
_update_duplicate_indicator();
break;
}
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(1,0,0),-Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_ROTATE_Z: {
Basis r;
if (input_action==INPUT_DUPLICATE) {
r.set_orthogonal_index(selection.duplicate_rot);
r.rotate(Vector3(0,0,1),-Math_PI/2.0);
selection.duplicate_rot=r.get_orthogonal_index();
_update_duplicate_indicator();
break;
}
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0,0,1),-Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_Y: {
Basis r;
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0,1,0),Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_X: {
Basis r;
//.........这里部分代码省略.........
示例3: _duplicate_paste
void GridMapEditor::_duplicate_paste() {
if (!selection.active)
return;
int idx = options->get_popup()->get_item_index(MENU_OPTION_DUPLICATE_SELECTS);
bool reselect = options->get_popup()->is_item_checked( idx );
List< __Item > items;
Basis rot;
rot.set_orthogonal_index(selection.duplicate_rot);
for(int i=selection.begin.x;i<=selection.end.x;i++) {
for(int j=selection.begin.y;j<=selection.end.y;j++) {
for(int k=selection.begin.z;k<=selection.end.z;k++) {
int itm = node->get_cell_item(i,j,k);
if (itm==GridMap::INVALID_CELL_ITEM)
continue;
int orientation = node->get_cell_item_orientation(i,j,k);
__Item item;
Vector3 rel=Vector3(i,j,k)-selection.begin;
rel = rot.xform(rel);
Basis orm;
orm.set_orthogonal_index(orientation);
orm = rot * orm;
item.pos=selection.begin+rel;
item.item=itm;
item.rot=orm.get_orthogonal_index();
items.push_back(item);
}
}
}
Vector3 ofs=selection.current-selection.click;
if (items.size()) {
undo_redo->create_action("GridMap Duplicate Selection");
for(List< __Item >::Element *E=items.front();E;E=E->next()) {
__Item &it=E->get();
Vector3 pos = it.pos+ofs;
undo_redo->add_do_method(node,"set_cell_item",pos.x,pos.y,pos.z,it.item,it.rot);
undo_redo->add_undo_method(node,"set_cell_item",pos.x,pos.y,pos.z,node->get_cell_item(pos.x,pos.y,pos.z),node->get_cell_item_orientation(pos.x,pos.y,pos.z));
}
undo_redo->commit_action();
}
if (reselect) {
selection.begin+=ofs;
selection.end+=ofs;
selection.click=selection.begin;
selection.current=selection.end;
_validate_selection();
}
}