struct PLANE {FLOAT X, Y, Z; D3DXVECTOR3 Normal; FLOAT U, V;};
class PlaneStruct
{
public:PLANE PlaneVertices[4];
public:DWORD PlaneIndices;
void CreatePlane(float size)
{
// create vertices to represent the corners of the cube
PlaneVertices =
{
{1.0f * size, 0.0f, 1.0f * size, D3DXVECTOR3(0.0f, 0.0f, 1.0f), 0.0f, 0.0f}, // side 1
{-1.0f * size, -0.0f, 1.0f * size, D3DXVECTOR3(0.0f, 0.0f, 1.0f), 0.0f, 1.0f},
{-1.0f * size, -0.0f, -1.0f * size, D3DXVECTOR3(0.0f, 0.0f, 1.0f), 1.0f, 0.0f},
{1.0f * size, -0.0f, -1.0f * size, D3DXVECTOR3(0.0f, 0.0f, 1.0f), 1.0f, 1.0f},
};
// create the index buffer out of DWORDs
DWORD PlaneIndices[] =
{
0, 2, 1, // side 1
0, 3, 2
};
}
};
这是我的“平面”结构代码,我只有一个问题,如果你看顶部,上面写着 PLANE PlaneVertices[4]; 然后在一个函数中我想定义它,所以给它特定的值,但我得到以下错误:表达式必须是一个可修改的值。请帮忙