i want to load a directx skinned mesh file and animate it with bone and some times i need to edit position of vertices individually.
i use this code to change vertices position:
Code: Select all
ISkinnedMesh * BaseMesh=(ISkinnedMesh*)m_Scene->getMesh("tmp.X");
SMeshBuffer * buf= (SMeshBuffer *) BaseMesh->getMeshBuffer(bufnum);
const S3DVertex * v1=(S3DVertex *)buf->getVertices();
//const S3DVertex * v2=(S3DVertex *)TargetMorphs[MTInd]->getMeshBuffer(bufnum)->getVertices();
u16 i;
for(i=0;i<buf->getVertexCount();i++)
{
vector3df *vec1=(vector3df *)&v1[i].Pos;
vector3df *vec2=(vector3df *)&v2[i].Pos;
vector3df tmp;
tmp=vec2->getInterpolated(*vec1,weight);
vec1->set(tmp);
}
buf->recalculateBoundingBox();
any one know what is problem?