So basically I created this little tree generation program using some space colonization algorithm, and it works pretty well, BUT!
For now I can only view the results in the engine itself:
I’m creating the model inside Urho3D in this way:
struct tVertex {
Tree::vec3f position, normal;
};
std::vector<tVertex> vertexData;
std::vector<Tree::vec3us> indexData;
//some magic filling in the data...
SharedPtr<VertexBuffer> vb(new VertexBuffer(context_));
vb->SetShadowed(true); // Shadowed buffer needed for raycasts to work, and so that data can be
automatically restored on device loss
PODVector<VertexElement> elements;
elements.Push(VertexElement(TYPE_VECTOR3, SEM_POSITION));
elements.Push(VertexElement(TYPE_VECTOR3, SEM_NORMAL));
vb->SetSize(vertexData.size(), elements);
vb->SetData(static_cast<void*>(vertexData.data()));
SharedPtr<IndexBuffer> ib(new IndexBuffer(context_));
ib->SetShadowed(true);
ib->SetSize(indexData.size() * 3, false);
ib->SetData(static_cast<void*>(indexData.data()));
SharedPtr<Geometry> geom(new Geometry(context_));
geom->SetVertexBuffer(0, vb);
geom->SetIndexBuffer(ib);
geom->SetDrawRange(TRIANGLE_LIST, 0, indexData.size() * 3);
return geom;
So please if someone knows how a way to export the geometry could you explain it to a Urho3D newbie? I know there is Assimp integration in the engine, thus theoretically exporting is possible out of the box?
Thanks for help in advance!