Archive 17/01/2023.

Custom mesh with non-interleaved vertex-normal

ganibc

Hi,

I have mesh data that doesn’t have vertex and normal interleaved (vert norm vert norm …).
The vertices are in 1 array and the normals are in separate array (vert vert … vert - norm norm … norm).
The samples that I found are always assumed the data is interleaved. Like the code below.

SharedPtrUrho3D::VertexBuffer vb(new Urho3D::VertexBuffer(context_));
vb->SetShadowed(true);
PODVector elements;
elements.Push(VertexElement(TYPE_VECTOR3, SEM_POSITION));
elements.Push(VertexElement(TYPE_VECTOR3, SEM_NORMAL));
vb->SetSize(meshData.vertices.size(), elements);
vb->SetData(meshData.vertices.data());

How do I set the normals data without making it interleave?
Thanks.

Eugene

Use two separate vertex buffers.

ganibc

Hi, Thanks for the reply.
Will try the code.

Edit:
It works. Thanks again.