本文整理汇总了C++中SimpleMesh::SetVisualizationMode方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleMesh::SetVisualizationMode方法的具体用法?C++ SimpleMesh::SetVisualizationMode怎么用?C++ SimpleMesh::SetVisualizationMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleMesh
的用法示例。
在下文中一共展示了SimpleMesh::SetVisualizationMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void Implicit::Update()
{
if (mVisualizationMode == Curvature) {
if(typeid(*mMesh) == typeid(SimpleMesh)) {
SimpleMesh * ptr = static_cast<SimpleMesh*>(mMesh);
std::vector<SimpleMesh::Vertex>& verts = ptr->GetVerts();
Matrix4x4<float> M = GetTransform().Transpose();
// Compute curvature of implicit geometry and assign to the vertex property
for(unsigned int i=0; i < verts.size(); i++){
const Vector3<float> vObject = verts.at(i).pos;
// Transform vertex position to world space
Vector4<float> vWorld = GetTransform() * Vector4<float>(vObject[0],vObject[1],vObject[2],1);
// Get curvature in world space
verts.at(i).curvature = GetCurvature(vWorld[0], vWorld[1], vWorld[2]);
// Get gradient in world space (used for lighting)
Vector3<float> nWorld = GetGradient(vWorld[0], vWorld[1], vWorld[2]);
// Transform gradient to object space
Vector4<float> nObject = M * Vector4<float>(nWorld[0],nWorld[1],nWorld[2],0);
verts.at(i).normal = Vector3<float>(nObject[0], nObject[1], nObject[2]).Normalize();
}
ptr->mAutoMinMax = mAutoMinMax;
ptr->mMinCMap = mMinCMap;
ptr->mMaxCMap = mMaxCMap;
ptr->SetVisualizationMode(Mesh::CurvatureVertex);
ptr->Update();
}
else {
std::cerr << "No Curvature visualization mode implemented for mesh type: " << typeid(*mMesh).name() << std::endl;
}
}
}