本文整理汇总了C#中IMesh.SetNumFaces方法的典型用法代码示例。如果您正苦于以下问题:C# IMesh.SetNumFaces方法的具体用法?C# IMesh.SetNumFaces怎么用?C# IMesh.SetNumFaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMesh
的用法示例。
在下文中一共展示了IMesh.SetNumFaces方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetFaces
public unsafe bool SetFaces(IMesh maxMesh, MyMesh myMesh)
{
bool countChanged = false;
TriangulateFaces(myMesh);
if (maxMesh.NumFaces != myMesh.TriangulatedFaces.Length)
{
maxMesh.SetNumFaces(myMesh.TriangulatedFaces.Length, false, false);
maxMesh.SetNumTVFaces(myMesh.TriangulatedFaces.Length, false, 0);
countChanged = true;
}
/* Get the default flags value */
IFace referenceFace = gi.Face.Create();
referenceFace.SetEdgeVisFlags(EdgeVisibility.Vis, EdgeVisibility.Vis, EdgeVisibility.Vis);
Face referenceMaxFace = *(Face*)referenceFace.NativePointer.ToPointer();
UInt32 referenceFlags = referenceMaxFace.flags;
/* Create the faces that define the surface of the mesh */
Face* faces = (Face*)maxMesh.Faces[0].NativePointer.ToPointer();
TVFace* tvfaces = (TVFace*)maxMesh.TvFace[0].NativePointer.ToPointer();
for (int i = 0; i < myMesh.TriangulatedFaces.Length; i++)
{
MyFace myFace = myMesh.TriangulatedFaces[i];
faces[i].v.v1 = (UInt32)myFace.PositionVertex1;
faces[i].v.v2 = (UInt32)myFace.PositionVertex2;
faces[i].v.v3 = (UInt32)myFace.PositionVertex3;
faces[i].flags = (UInt32)((ushort)myFace.MaterialId << 16) | (ushort)referenceFlags;
tvfaces[i].t1 = (UInt32)myFace.TextureVertex1;
tvfaces[i].t2 = (UInt32)myFace.TextureVertex2;
tvfaces[i].t3 = (UInt32)myFace.TextureVertex3;
};
return countChanged;
}