So I have created a model in Ogre3D and this model is made up of a number of triangles of arbitrary rotation and position. I would like to "unwrap" the model like many modelling programs do so that all of the triangles are mapped to 2d (x,y) but the triangle sizes are maintained. This is for applying decals. The reason the triangle sizes must be maintained so that when the texture is applied there isn't any stretching.
This was the direction I was thinking of going in but I am having trouble visualizing it and achieving the correct algorithms:
//Verticies will have a converted bool;
func( triangle x):
for each of x's vertices:
map to x,y coordinates if not converted;
check other triangles for common vertex if so call func(common_tri);
Once this returns there will be a converted version of all of the triangles so that they are all unwrapped and placeable on the texture, where I am having trouble is the mapping to x,y space. I'm not sure how to get a triangle in 3d space to 2d space so that it maintains all of its attributes (like going from an angled view to a perpedicular view of the surface) Any help would be greatly appreciated.