|
In MoBu2010, we had a code that returns the positions of a specific vertex, even if the node belongs to a deformed blendshape. In MoBu2012, we get the position of the vertex without the blendshape deformation.
Question : how can we get the position the vertex in the deformed blendshape ?
float getVertexPositionMoBu2010(char *modelName, int vertexID, int XYZ)
{
FBVector4d currentVertex;
FBVector4d result;
HFBModel lModelSource = FBFindModelByName( modelName );
if (!lModelSource)
return -FLT_MAX ;
HFBGeometry Geom = lModelSource->Geometry;
float* PositionArray = Geom->GetPositionArray();
FBMatrix mTransformationMatrix;
mTransformationMatrix.Set( Geom->GetTransformationMatrix() );
currentVertex[0] = PositionArray[4*vertexID + 0];
currentVertex[1] = PositionArray[4*vertexID + 1];
currentVertex[2] = PositionArray[4*vertexID + 2];
currentVertex[3] = 1.0;
FBVectorMatrixMult(result, mTransformationMatrix, currentVertex);
return result[XYZ];
}
float getVertexPositionMoBu2012(char *modelName, int vertexID, int XYZ)
{
FBVector4d currentVertex;
FBVector4d result;
HFBModel lModelSource = FBFindModelByLabelName( modelName );
if (!lModelSource)
return -FLT_MAX ;
//
HFBGeometry Geom = (HFBGeometry)lModelSource->Geometry;
FBVertex* PositionArray = Geom->GetVertexes();
currentVertex[0] = PositionArray[vertexID][0];
currentVertex[1] = PositionArray[vertexID][1];
currentVertex[2] = PositionArray[vertexID][2];
currentVertex[3] = 1.0;
// Gestion TRS du model :
FBMatrix mTransformationMatrix;
lModelSource->GetMatrix(mTransformationMatrix);
FBVectorMatrixMult(result, mTransformationMatrix, currentVertex);
return result[XYZ];
}
|
|
|