EDIT: Jul 15, 14:03 = fixed a few things in the code, and simplified a little
@mongoose7
Incorporating hybrid's suggestion about the polygonOffsetFactor is quite complicated. Better to just wait until the next release, and then figure that one out.
In the meantime, here is my function to nudge the wireframe towards the camera prior to rendering.
It mostly works. I used an ugly magic constant of 0.1 for the nudge-vector length. I imagine with different sized meshes this number would have to be adjusted appropriately by some formula.
The wireframe looks alright, but there are a few wires dipping into the mesh and a few extending too far out.
This definitely feels ugly and messy, and doesn't satisfy my desire for a clean solution.
I'm waiting for the 1.8 release and hoping this polygonOffset will do the trick.
Any other ideas anyone?
Code: Select all
vector3df nudge_vec (cam->getPosition() - wireframe_node->getPosition());
nudge_vec.setLength (0.1); // magic constant!
wireframe_node->setPosition (wireframe_node->getPosition() + nudge_vec);
smgr->drawAll();
wireframe_node->setPosition (mesh_node->getPosition()); // back to original position