I recently decided to try out bullet, mainly the soft-body part of the libary. I managed to asign a piece of clothing using btSoftBodyHelpers::CreatePatch(), and render its faces with Direct3D. However, I've got a question: How do I calculate the texture coordinates of every face? I'm reading the face-data like this:
Code: Select all
for(int i=0;i<Faces.size();++i)
{
btSoftBody::Node* node_0=Faces[i].m_n[0];
btSoftBody::Node* node_1=Faces[i].m_n[1];
btSoftBody::Node* node_2=Faces[i].m_n[2];
Data[j].fX = node_0->m_x.x();
Data[j].fY = node_0->m_x.y();
Data[j].fZ = node_0->m_x.z();
Data[j].tex0 = ???;
Data[j].tex1 = ???;
j+=1;
Data[j].fX = node_1->m_x.x();
Data[j].fY = node_1->m_x.y();
Data[j].fZ = node_1->m_x.z();
Data[j].tex0 = ???;
Data[j].tex1 = ???;
j+=1;
Data[j].fX = node_2->m_x.x();
Data[j].fY = node_2->m_x.y();
Data[j].fZ = node_2->m_x.z();
Data[j].tex0 = ???;
Data[j].tex1 = ???;
j+=1;
}