How can I create a mesh?
I mean without a file, just with code.
Can I create a MeshBuffer like:
createMeshBuffer(int VertexCount, int IndexCount, int FaceCount)
???
How to Create a Mesh
Re: How to Create a Mesh
I was just about to ask the same question. Could someone perhaps kindly provide a simple tutorial on how to create a cube or a pyramid and how to set textures for a surface etc.Krendor wrote:How can I create a mesh? I mean without a file, just with code.
Have a look at the documentation for SMesh and SMeshBuffer. Just allocate a mesh buffer, and modify the vertex and index array directly...
Code: Select all
scene::SMeshBuffer* mesh = new SMeshBuffer;
mesh->Vertices.push_back(video::S3DVertex(...));
mesh->Vertices.push_back(video::S3DVertex(...));
mesh->Vertices.push_back(video::S3DVertex(...));
mesh->Vertices.push_back(video::S3DVertex(...));
mesh->Indices.push_back(0);
mesh->Indices.push_back(1);
mesh->Indices.push_back(2);
mesh->Indices.push_back(3);