Exporting transformed mesh polys (as DXF)

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
KevinCain
Posts: 18
Joined: Tue Aug 15, 2006 5:00 pm
Location: San Francisco

Exporting transformed mesh polys (as DXF)

Post by KevinCain »

Hello one and all,

My goal is to export triangle geometry *from* irrlicht into an ASCII file -- AutoCAD .DXF.

I'm starting with a cylinder primitive at (0, 0, 0), which I scale, rotate, and translate into place to fit my needs. I've imported an OBJ file (a cylinder primitive) into irr::scene::IMesh and transformed the mesh by setScale, setPosition, and parented the node via setParent.

My question is: how is it possible to get a list of the transformed poly vertices and indices for the transformed parent node, so I can store the list in a file?

The format I want to export to (.DXF) uses a similar mesh representation to Irrlicht: vertices in a list, and then poly face definitions that reference those vertex indices to create geometry. I haven't had to access vertices or indices for a mesh before, however, and don't know how to get a list of vertices/indices connected to a given node.

If anyone is aware of other threads about geometry export from Irrlicht, or can suggest a starting point, I'd be extremely grateful.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

I guess you grab the absolute transformation of the node and then multiply each vertex by that to get their resulting position to be output...

You get the mesh by doing node->getMesh() (if you've got an IMeshSceneNode pointer) and then you can get the meshbuffers from the IMesh.

The poly list would be the indices from the meshbuffers.
Image Image Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

In order to integrate this export module properly with Irrlicht you should write an IMeshWriter interface for DXF. Then, you get the absolute transformation matrix and pass that, together with the mesh, to the meshmanipulator method getTransformedMesh. The transformed mesh is passed to the mesh writer.
Post Reply