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


C++ MyMesh::material方法代码示例

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


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

示例1: Load

bool Load(const char* filename, MyMesh& mesh)
{
  //Create the data descriport for the custom attributes
  nanoply::NanoPlyWrapper<MyMesh>::CustomAttributeDescriptor customAttrib;
  customAttrib.GetMeshAttrib(filename);
  int count = customAttrib.meshAttribCnt["material"];
  mesh.material().resize(count);
  customAttrib.AddVertexAttribDescriptor<int, int, 1>(std::string("materialId"), nanoply::NNP_INT32, NULL);
  customAttrib.AddFaceAttribDescriptor<vcg::Point3f, float, 3>(std::string("barycenter"), nanoply::NNP_LIST_UINT8_FLOAT32, NULL);
  customAttrib.AddMeshAttribDescriptor<Material, float, 3>(std::string("material"), std::string("kd"), nanoply::NNP_FLOAT32, mesh.material()[0].kd.V());
  customAttrib.AddMeshAttribDescriptor<Material, float, 3>(std::string("material"), std::string("ks"), nanoply::NNP_FLOAT32, mesh.material()[0].ks.V());
  customAttrib.AddMeshAttribDescriptor<Material, float, 1>(std::string("material"), std::string("rho"), nanoply::NNP_FLOAT32, &mesh.material()[0].rho);

  //Load the ply file
  unsigned int mask = 0;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_VERTCOORD;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_VERTNORMAL;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_VERTCOLOR;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_VERTRADIUS;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_VERTATTRIB;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_FACEINDEX;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_FACENORMAL;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_FACEATTRIB;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_MESHATTRIB;
  return (nanoply::NanoPlyWrapper<MyMesh>::LoadModel(filename, mesh, mask, customAttrib) != 0);
}
开发者ID:baceituno,项目名称:surface-reconstruction,代码行数:26,代码来源:main.cpp

示例2: Save

bool Save(const char* filename, MyMesh& mesh, bool binary)
{
  //Create the data descriport for the custom attributes
  nanoply::NanoPlyWrapper<MyMesh>::CustomAttributeDescriptor customAttrib;
  customAttrib.AddVertexAttribDescriptor<int, int, 1>(std::string("materialId"), nanoply::NNP_INT32, &mesh.vertexMaterial[0]);
  customAttrib.AddFaceAttribDescriptor<vcg::Point3f, float, 3>(std::string("barycenter"), nanoply::NNP_LIST_UINT8_FLOAT32, mesh.faceBarycenter[0].V());
  customAttrib.AddMeshAttrib(std::string("material"), 2);
  customAttrib.AddMeshAttribDescriptor<Material, float, 3>(std::string("material"), std::string("kd"), nanoply::NNP_LIST_UINT8_FLOAT32, mesh.material()[0].kd.V());
  customAttrib.AddMeshAttribDescriptor<Material, float, 3>(std::string("material"), std::string("ks"), nanoply::NNP_LIST_UINT8_FLOAT32, mesh.material()[0].ks.V());
  customAttrib.AddMeshAttribDescriptor<Material, float, 1>(std::string("material"), std::string("rho"), nanoply::NNP_FLOAT32, &mesh.material()[0].rho);

  //Save the ply file
  unsigned int mask = 0;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_VERTCOORD;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_VERTNORMAL;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_VERTCOLOR;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_VERTRADIUS;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_VERTATTRIB;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_FACEINDEX;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_FACENORMAL;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_FACEATTRIB;
  mask |= nanoply::NanoPlyWrapper<MyMesh>::IO_MESHATTRIB;
  return nanoply::NanoPlyWrapper<MyMesh>::SaveModel(filename, mesh, mask, customAttrib, binary);
}
开发者ID:baceituno,项目名称:surface-reconstruction,代码行数:24,代码来源:main.cpp


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