I am working on 3D vertex skinning. Everything is working fine. I am now stuck on how to best represent my bones graphically. I recognize that I can draw the bones as simple lines from one joint to the next.
However, I strongly want to draw something similar to that of blenders graphical representation of blender bones ( with heads and tails).
I sample code I have( below ) works however only for joints that are facing in the direction (0,1,0). If I have a bone facing (1,0,0), then it does not accurately represent that bone.
So ultimately, my question is: is there a math equation to use to orientate these vertices from (0,1,0) to some arbitrary vector direction based on how my bone joints are facing.
glm::vec3 vert[14];
vert[ 0] = glm::vec3( 0.0f, 0.0f, 0.0f);
vert[ 1] = glm::vec3(-0.2f, 0.2f,-0.2f);
vert[ 2] = glm::vec3( 0.2f, 0.2f,-0.2f);
vert[ 3] = glm::vec3( 0.0f, getLength(), 0.0f);
vert[ 4] = glm::vec3(-0.2f, 0.2f,-0.2f);
vert[ 5] = glm::vec3(-0.2f, 0.2f, 0.2f);
vert[ 6] = glm::vec3( 0.0f, 0.0f, 0.0f);
vert[ 7] = glm::vec3( 0.2f, 0.2f,-0.2f);
vert[ 8] = glm::vec3( 0.2f, 0.2f, 0.2f);
vert[ 9] = glm::vec3( 0.0f, 0.0f, 0.0f);
vert[10] = glm::vec3(-0.2f, 0.2f, 0.2f);
vert[11] = glm::vec3( 0.0f, getLength(), 0.0f);
vert[12] = glm::vec3( 0.2f, 0.2f, 0.2f);
vert[13] = glm::vec3(-0.2f, 0.2f, 0.2f);