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


C++ Triangle::ReplaceVertex方法代码示例

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


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

示例1: Set


//.........这里部分代码省略.........
		vertex_split->num_new_triangles_ = (int)edge_to_collapse.triangle_list_.size();

		SetDeltaScalars(vertex_split->delta_scalars_,
				edge_to_collapse.v1_->scalars_,
				edge_to_collapse.v2_->scalars_);

		CopyAddScalars(vertex_split->pivot_scalars_,
				edge_to_collapse.v2_->scalars_,
				vertex_split->delta_scalars_);

		CopyScalars(edge_to_collapse.v2_->scalars_,
				vertex_split->pivot_scalars_);

		TriangleList::iterator tri_iter;

		for (tri_iter = edge_to_collapse.triangle_list_.begin();
			tri_iter != edge_to_collapse.triangle_list_.end();
			++tri_iter) {
			Triangle* triangle = *tri_iter;
			_triangle_list.remove(triangle);
			vertex_split->new_triangles_.push_back(triangle);
		}

		// Setup the affected triangles. Affected triangles are those that
		// are sharing the vertex that will be removed. We need to change the pointer that
		// points at the removed vertex to point to the other vertex instead.
		for (tri_iter =  _triangle_list.begin();
			tri_iter != _triangle_list.end();
			++tri_iter) {
			Triangle* triangle = *tri_iter;

			if (triangle->HaveVertex(edge_to_collapse.v1_) == true) {
				vertex_split->fix_triangles_.push_back(triangle);
				triangle->ReplaceVertex(edge_to_collapse.v1_, vertex_split->vertex_to_split_);

				// If two vertices are the same.
				if (triangle->v1_ == triangle->v2_ ||
				   triangle->v1_ == triangle->v3_ ||
				   triangle->v2_ == triangle->v3_) {
					deb_assert(false);
				}
			}
		}

		// Place V2 last in the list, and remove V1 completely.
		_vertex_list.remove(edge_to_collapse.v1_);
		_vertex_list.remove(edge_to_collapse.v2_);
		_vertex_list.push_back(edge_to_collapse.v2_);
	} // End while(lVertexCount > 1)


	// Now we are all done calculating the vertex splits.
	// It's time to generate the final data.

	// Start with creating the lowest level mesh data.
	base_vertex_count_ = (int)_vertex_list.size();
	base_triangle_count_ = (int)_triangle_list.size();
	num_vertex_splits_ = (int)vertex_split_list.size();

	current_vertex_count_ = base_vertex_count_;
	current_triangle_count_ = base_triangle_count_;

	base_vertex_data_ = new float[base_vertex_count_ * 3];
	base_normal_data_ = new float[base_vertex_count_ * 3];
	current_vertex_data_ = new float[(current_vertex_count_ + num_vertex_splits_) * 3];
	current_normal_data_ = new float[(current_vertex_count_ + num_vertex_splits_) * 3];
开发者ID:highfestiva,项目名称:life,代码行数:67,代码来源:uiprogressivetrianglegeometry.cpp


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