Skip to content
Discussion options

You must be logged in to vote

I seem to know how to construct it, but I still don't understand why the previous code went wrong. Is it convenient to explain?

The following is the correct usage.
`

Trade::MeshData createPlane1(Float width, Float height) {
    struct Vertex {
	    Vector3 position;
    };

    Float halfWidth = width * 0.5f;
    Float halfHeight = height * 0.5f;
    Containers::Array<Vertex> vertices{ 4 };
    vertices[0] = { {halfWidth, -halfHeight, 0.0f}}; 
    vertices[1] = { { halfWidth, halfHeight, 0.0f}}; 
    vertices[2] = { {-halfWidth,  -halfHeight, 0.0f}}; 
    vertices[3] = { { -halfWidth,  halfHeight, 0.0f} };

    Containers::StridedArrayView1D<Vector3> positionView = Containers::stridedArra…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by fenggy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant