这里我想继续写点和Mesh有关的东西,毕竟我们可能还需要对它有很多别的要求。在3D游戏的实际运用中,一般来说都是运用低多边形模型,简称低模。这样才能有更加好的速度来运行游戏,恰好DX中有提供给我们这样的函数让我们来控制读入的Mesh的复杂程度。
public void WeldVertices (
Microsoft.DirectX.Direct3D.WeldEpsilonsFlags flags ,//标志
Microsoft.DirectX.Direct3D.WeldEpsilons epsilons ,
Microsoft.DirectX.Direct3D.GraphicsStream adjacencyIn ,
Microsoft.DirectX.Direct3D.GraphicsStream adjacencyOut ,
out int[] faceRemap ,
Microsoft.DirectX.Direct3D.GraphicsStream vertexRemap )
这个方法能实现简化模型的目的,前2个参数用来确定怎么简化模型,
第一个标志一共包括以下几个:
Member
Value
Description
DoNotSplit
8
Instructs the weld to allow vertices to be modified only, not removed. This flag is valid only if WeldPartialMatches is set. It is useful to modify vertices so that they are equal, but not to allow vertices to be removed.
只有当WeldPartialMatches参数指定时才能生效,不允许分离定点
DoNotRemoveVertices
4
Instructs the weld to allow vertices to be modified only, not removed. This flag is valid only if WeldPartialMatches is set. It is useful to modify vertices to be equal, but not to allow vertices to be removed.
只有当WeldPartialMatches参数指定时才能生效,不能移除定点,只能修改
WeldPartialMatches
2
If a given vertex component is within epsilon, instructs the weld to modify partially matched vertices so that both components are equal. If all components are equal, one of the vertices is removed.