Convert manual object to mesh (v2)

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


User avatar
TaaTT4
OGRE Contributor
OGRE Contributor
Posts: 267
Joined: Wed Apr 23, 2014 3:49 pm
Location: Bologna, Italy
x 75

Convert manual object to mesh (v2)

Post by TaaTT4 »

As the title says, is there a way to convert a v2 manual object in a v2 mesh? For v1 classes, exists a convertToMesh convenience method. Or do I have to mimic what the DynamicGeometry sample does and submit a PR? :D

Senior programmer at 505 Games; former senior engine programmer at Sandbox Games
Worked on: Racecraft EsportRacecraft Coin-Op, Victory: The Age of Racing

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5505
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1372

Re: Convert manual object to mesh (v2)

Post by dark_sylinc »

I don't know if there is (ManualObject was a contribution, I didn't write the code).

But ManualObject, like any v2 object, has its own VertexArrayObject, with its own VertexBuffers, with its own IndexBuffers; and the local AABB & Material data is already available; which is all you need to construct a Mesh and a SubMesh.

Therefore it should be relative trivial to write a conversion routine that either duplicates these structures (use BufferPacked::copyTo and create a new Vao) or just give away the pointers and its ownership (i.e. don't leave dangling pointers)
User avatar
TaaTT4
OGRE Contributor
OGRE Contributor
Posts: 267
Joined: Wed Apr 23, 2014 3:49 pm
Location: Bologna, Italy
x 75

Re: Convert manual object to mesh (v2)

Post by TaaTT4 »

Senior programmer at 505 Games; former senior engine programmer at Sandbox Games
Worked on: Racecraft EsportRacecraft Coin-Op, Victory: The Age of Racing