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


C++ VS::mesh_get_surface_count方法代码示例

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


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

示例1: edit

void GridMapEditor::edit(GridMap *p_gridmap) {

	node=p_gridmap;
	VS *vs = VS::get_singleton();

	last_mouseover=Vector3(-1,-1,-1);
	input_action=INPUT_NONE;
	selection.active=false;
	_update_selection_transform();
	_update_duplicate_indicator();

	spatial_editor  = editor->get_editor_plugin_screen()->cast_to<SpatialEditorPlugin>();

	if (!node) {
		set_process(false);
		for(int i=0;i<3;i++) {
			VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_VISIBLE,false);

		}

		VisualServer::get_singleton()->instance_geometry_set_flag(cursor_instance, VS::INSTANCE_FLAG_VISIBLE,false);

		_clear_areas();

		return;
	}


	update_pallete();
	update_areas();

	set_process(true);

	Vector3 edited_floor = p_gridmap->get_meta("_editor_floor_");
	clip_mode=p_gridmap->has_meta("_editor_clip_")?ClipMode(p_gridmap->get_meta("_editor_clip_").operator int()):CLIP_DISABLED;



	for(int i=0;i<3;i++) {
		if (vs->mesh_get_surface_count(grid[i])>0)
			vs->mesh_remove_surface(grid[i],0);
		edit_floor[i]=edited_floor[i];

	}

	{

		//update grids
		indicator_mat = VisualServer::get_singleton()->fixed_material_create();
		VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_UNSHADED, true );
		VisualServer::get_singleton()->material_set_flag( indicator_mat, VisualServer::MATERIAL_FLAG_ONTOP, false );

		VisualServer::get_singleton()->fixed_material_set_param(indicator_mat,VisualServer::FIXED_MATERIAL_PARAM_DIFFUSE,Color(0.8,0.5,0.1));
		VisualServer::get_singleton()->fixed_material_set_flag( indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_ALPHA, true );
		VisualServer::get_singleton()->fixed_material_set_flag( indicator_mat, VisualServer::FIXED_MATERIAL_FLAG_USE_COLOR_ARRAY, true );


		Vector<Vector3> grid_points[3];
		Vector<Color> grid_colors[3];

		float cell_size[3]={p_gridmap->get_cell_size(),p_gridmap->get_cell_size(),p_gridmap->get_cell_size()};

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

			Vector3 axis;
			axis[i]=1;
			Vector3 axis_n1;
			axis_n1[(i+1)%3]=cell_size[(i+1)%3];
			Vector3 axis_n2;
			axis_n2[(i+2)%3]=cell_size[(i+2)%3];

			for(int j=-GRID_CURSOR_SIZE;j<=GRID_CURSOR_SIZE;j++) {

				for(int k=-GRID_CURSOR_SIZE;k<=GRID_CURSOR_SIZE;k++) {

					Vector3 p = axis_n1*j + axis_n2 *k;
					float trans = Math::pow(MAX(0,1.0-(Vector2(j,k).length()/GRID_CURSOR_SIZE)),2);

					Vector3 pj = axis_n1*(j+1) + axis_n2 *k;
					float transj = Math::pow(MAX(0,1.0-(Vector2(j+1,k).length()/GRID_CURSOR_SIZE)),2);

					Vector3 pk = axis_n1*j + axis_n2 *(k+1);
					float transk = Math::pow(MAX(0,1.0-(Vector2(j,k+1).length()/GRID_CURSOR_SIZE)),2);

					grid_points[i].push_back(p);
					grid_points[i].push_back(pk);
					grid_colors[i].push_back(Color(1,1,1,trans));
					grid_colors[i].push_back(Color(1,1,1,transk));

					grid_points[i].push_back(p);
					grid_points[i].push_back(pj);
					grid_colors[i].push_back(Color(1,1,1,trans));
					grid_colors[i].push_back(Color(1,1,1,transj));
				}

			}

			Array d;
			d.resize(VS::ARRAY_MAX);
			d[VS::ARRAY_VERTEX]=grid_points[i];
//.........这里部分代码省略.........
开发者ID:baekdahl,项目名称:godot,代码行数:101,代码来源:grid_map_editor_plugin.cpp


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