I'm trying to export my scene to my own text format and I came along the following problem:
When I do my own custom scene nodes, everything works fine, but when I try to export the meshbuffers of mesh scene nodes loaded from md2 or any other format - I get the original vertex coordinates, instead of the ones I expect after multiple calls to setRotation, setPosition or setScale on the scene node.
You usually have X nodes and one single mesh. And on rendering the nodes transform that mesh each frame (that's way faster than uploading a changed mesh all the time). So you always export the same mesh - meshes don't change. And for nodes you export scaling, rotation and position (+ maybe the name of your mesh). If you really want to change the mesh itself (very rarely the case!) you would work with the transform function of IMeshManipulator.
I don't necessarily need to change the meshes themselves, but I cannot export any other parameters than vertex coordinates. I'm just looking for a way to obtain a list of transformed vertices, whether by changing the mesh or not - that's not significant. Just to be clear - my goal is to export what is being rendered, not loaded, transformed etc... ie, exactly what I see on the screen.
You are sending the mesh + transformation matrices to the graphic card. The transformation from mesh-coordinates to something on the screen is happening on the graphic card. The vertex-coordinates are at no point changed in your main-memory. I don't think there is any easy way getting that back from the graphic card (although I guess it's probably possible with some shader programs). But unless you have a very strange format there is simply no point in working with the transformed vertices - working with the mesh + transformations is so much easier.
edit: Note - if you absolutely need this for some reason then you can do manually the same transformations which the card usually does for you by hand. Method would be as described above - you would use the transform functions of the MeshManipulator and give it the absolute transformation of the scenenode (ISceneNode::getAbsoluteTransformation will return that). But maybe describe first why you can't just put the transformations in your export instead - it makes so much more sense.
edit2: The "exactly what I see on the screen" is a 2d image - which is the end-result of applying a bunch of transformations on a given 3d mesh and doing some additional clipping (using the depth-buffer information). There's a screenshot function for that...
...as for your edit2 - my mistake, I obviously meant the 3D scene.
I don't think exporting transformations is the way to go, because I need co create something easily reparseable into a bunch of different open formats, such as .obj, which I don't think supports transformations. Or am I wrong here as well?
Anyway, MeshManipulator seems like the way to go, thanks a bunch for your help!
OK, I have to admit exporting the whole scene is a single .obj file is indeed something where you will need this. Be careful - usually scenenodes do share their meshes, so you have to copy the mesh before transforming them (IMeshManipulator also has a function for that).