我已經問題在C#陣列。我在C#中很新,我習慣用java做程序。 我想從C++調用這個代碼爲C#。 這是C++陣列中結構C#
typedef struct point_3d { // Structure for a 3-dimensional point (NEW)
double x, y, z;
} POINT_3D;
typedef struct bpatch { // Structure for a 3rd degree bezier patch (NEW)
POINT_3D anchors[4][4]; // 4x4 grid of anchor points
GLuint dlBPatch; // Display List for Bezier Patch
GLuint texture; // Texture for the patch
} BEZIER_PATCH;
我已經在C#中的Vector3結構是浮動的X,Y,Z(我不需要雙...) 現在我試圖使結構用bpatch和我的代碼陣列的申報有問題
[StructLayout(LayoutKind.Sequential)]
struct BPatch
{
Vector3[][] anchors = new Vector3[4][4]; //there is the problem
uint dblPatch; // I'll probably have to change this two lines but it doesn't matter now
uint texture;
}
我該怎麼做錯?我需要在結構阿雷4×4,它的類型應該是其被聲明爲浮動的x,浮子Y,浮子Ž結構的Vector3。 由於
什麼讓你覺得C++'POINT_3D'轉換到.NET'Vector3'? – Oded 2011-12-31 15:58:40
爲什麼不呢?我按照NEHE http://nehe.gamedev.net/tutorial/bezier_patches__fullscreen_fix/18003/ 的這個教程工作,point3D有座標x,y,z和Vector3我提到我已經準備好在圖書館裏使用它,它給了我們我們的大學老師,還有操作添加和其他人..所以我用它。 – user1097772 2011-12-31 16:45:06