当前位置: 首页>>代码示例>>C++>>正文


C++ PoolVector::insert方法代码示例

本文整理汇总了C++中PoolVector::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ PoolVector::insert方法的具体用法?C++ PoolVector::insert怎么用?C++ PoolVector::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PoolVector的用法示例。


在下文中一共展示了PoolVector::insert方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: forward_gui_input


//.........这里部分代码省略.........
							Vector2 closest_pos;
							real_t closest_dist = 1e10;

							for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) {

								PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j);

								int pc = points.size();
								PoolVector<Vector2>::Read poly = points.read();

								for (int i = 0; i < pc; i++) {

									Vector2 points[2] = { xform.xform(poly[i]),
										xform.xform(poly[(i + 1) % pc]) };

									Vector2 cp = Geometry::get_closest_point_to_segment_2d(gpoint, points);
									if (cp.distance_squared_to(points[0]) < CMP_EPSILON2 || cp.distance_squared_to(points[1]) < CMP_EPSILON2)
										continue; //not valid to reuse point

									real_t d = cp.distance_to(gpoint);
									if (d < closest_dist && d < grab_threshold) {
										closest_dist = d;
										closest_outline = j;
										closest_pos = cp;
										closest_idx = i;
									}
								}
							}

							if (closest_idx >= 0) {

								pre_move_edit = node->get_navigation_polygon()->get_outline(closest_outline);
								PoolVector<Point2> poly = pre_move_edit;
								poly.insert(closest_idx + 1, xform.affine_inverse().xform(closest_pos));
								edited_point = closest_idx + 1;
								edited_outline = closest_outline;
								edited_point_pos = xform.affine_inverse().xform(closest_pos);
								node->get_navigation_polygon()->set_outline(closest_outline, poly);
								canvas_item_editor->get_viewport_control()->update();
								return true;
							}
						} else {

							//look for points to move
							int closest_outline = -1;
							int closest_idx = -1;
							Vector2 closest_pos;
							real_t closest_dist = 1e10;

							for (int j = 0; j < node->get_navigation_polygon()->get_outline_count(); j++) {

								PoolVector<Vector2> points = node->get_navigation_polygon()->get_outline(j);

								int pc = points.size();
								PoolVector<Vector2>::Read poly = points.read();

								for (int i = 0; i < pc; i++) {

									Vector2 cp = xform.xform(poly[i]);

									real_t d = cp.distance_to(gpoint);
									if (d < closest_dist && d < grab_threshold) {
										closest_dist = d;
										closest_pos = cp;
										closest_outline = j;
										closest_idx = i;
开发者ID:rinart73,项目名称:godot,代码行数:67,代码来源:navigation_polygon_editor_plugin.cpp

示例2: godot_pool_byte_array_insert

godot_error GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) {
	PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self;
	return (godot_error)self->insert(p_idx, p_data);
}
开发者ID:Ranakhamis,项目名称:godot,代码行数:4,代码来源:pool_arrays.cpp

示例3: godot_pool_color_array_insert

godot_error GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data) {
	PoolVector<Color> *self = (PoolVector<Color> *)p_self;
	Color &s = *(Color *)p_data;
	return (godot_error)self->insert(p_idx, s);
}
开发者ID:Ranakhamis,项目名称:godot,代码行数:5,代码来源:pool_arrays.cpp

示例4:

godot_error GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) {
	PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self;
	Vector3 &s = *(Vector3 *)p_data;
	return (godot_error)self->insert(p_idx, s);
}
开发者ID:Ranakhamis,项目名称:godot,代码行数:5,代码来源:pool_arrays.cpp

示例5: godot_pool_string_array_insert

godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data) {
	PoolVector<String> *self = (PoolVector<String> *)p_self;
	String &s = *(String *)p_data;
	return (godot_error)self->insert(p_idx, s);
}
开发者ID:Ranakhamis,项目名称:godot,代码行数:5,代码来源:pool_arrays.cpp

示例6: godot_pool_real_array_insert

godot_error GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data) {
	PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self;
	return (godot_error)self->insert(p_idx, p_data);
}
开发者ID:Ranakhamis,项目名称:godot,代码行数:4,代码来源:pool_arrays.cpp


注:本文中的PoolVector::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。