0
有沒有簡單的方法或c#類來獲得一個立方體的12個三角形 其中,只有(MIN,MAX)座標爲BoundingBox cube 我想使用PrimitiveType.TriangleList渲染立方體的面,但不知道如何獲得1235個三角形的靜態索引數組,它可以由立方體的MIN,MAX頂點定義。XNA C#獲得一個立方體的12個三角形面,給定(MIN,MAX)的BoundingBox
我使用C#和XNA。
有沒有簡單的方法或c#類來獲得一個立方體的12個三角形 其中,只有(MIN,MAX)座標爲BoundingBox cube 我想使用PrimitiveType.TriangleList渲染立方體的面,但不知道如何獲得1235個三角形的靜態索引數組,它可以由立方體的MIN,MAX頂點定義。XNA C#獲得一個立方體的12個三角形面,給定(MIN,MAX)的BoundingBox
我使用C#和XNA。
我想通了....這是爲我工作..not知道這是否是geralized辦法做到這一點
static float a , b , h ;
static Vector3 MinV = new Vector3(0f, 0f, 0f);
static Vector3 MaxV = new Vector3(a, b, h);
Vector3 topLeftBack = new Vector3(MinV.X, MaxV.Y, MinV.Z);
Vector3 topRightBack = new Vector3(MaxV.X, MaxV.Y, MinV.Z);
Vector3 bottomLeftBack = new Vector3(MinV.X, MinV.Y, MinV.Z); //min
Vector3 bottomRightBack = new Vector3(MaxV.X, MinV.Y, MinV.Z);
Vector3 topLeftFront = new Vector3(MinV.X, MaxV.Y, MaxV.Z);
Vector3 topRightFront = new Vector3(MaxV.X, MaxV.Y, MaxV.Z); //max
Vector3 bottomLeftFront = new Vector3(MinV.X, MinV.Y, MaxV.Z);
Vector3 bottomRightFront = new Vector3(MaxV.X, MinV.Y, MaxV.Z);