本文整理汇总了C++中MatrixF::getScale方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixF::getScale方法的具体用法?C++ MatrixF::getScale怎么用?C++ MatrixF::getScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixF
的用法示例。
在下文中一共展示了MatrixF::getScale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zapScale
void TSShapeLoader::zapScale(MatrixF& mat)
{
Point3F invScale = mat.getScale();
invScale.x = invScale.x ? (1.0f / invScale.x) : 0;
invScale.y = invScale.y ? (1.0f / invScale.y) : 0;
invScale.z = invScale.z ? (1.0f / invScale.z) : 0;
mat.scale(invScale);
}
示例2: lookupSkinData
//.........这里部分代码省略.........
S32 minIndex = weight.size() - TSSkinMesh::BatchData::maxBonePerVert;
F32 minWeight = weight[minIndex];
for (S32 i = minIndex + 1; i < weight.size(); i++)
{
if (weight[i] < minWeight)
{
minWeight = weight[i];
minIndex = i;
}
}
boneIndex[minIndex] = bIndex;
weight[minIndex] = bWeight;
}
else
{
vertexIndex.push_back( iVert );
boneIndex.push_back( bIndex );
weight.push_back( bWeight );
nonZeroWeightCount++;
}
}
}
// Normalize vertex weights (force weights for each vert to sum to 1)
int iWeight = 0;
while (iWeight < weight.size()) {
// Find the last weight with the same vertex number, and sum all weights for
// that vertex
F32 invTotalWeight = 0;
int iLast;
for (iLast = iWeight; iLast < weight.size(); iLast++) {
if (vertexIndex[iLast] != vertexIndex[iWeight])
break;
invTotalWeight += weight[iLast];
}
// Then normalize the vertex weights
invTotalWeight = 1.0f / invTotalWeight;
for (; iWeight < iLast; iWeight++)
weight[iWeight] *= invTotalWeight;
}
// Add dummy AppNodes to allow Collada joints to be mapped to 3space nodes
bones.setSize(streams.joints.size());
initialTransforms.setSize(streams.joints.size());
for (int iJoint = 0; iJoint < streams.joints.size(); iJoint++)
{
const char* jointName = streams.joints.getStringValue(iJoint);
// Lookup the joint element
const domNode* joint = 0;
if (instanceCtrl->getSkeleton_array().getCount()) {
// Search for the node using the <skeleton> as the base element
for (int iSkel = 0; iSkel < instanceCtrl->getSkeleton_array().getCount(); iSkel++) {
xsAnyURI skeleton = instanceCtrl->getSkeleton_array()[iSkel]->getValue();
daeSIDResolver resolver(skeleton.getElement(), jointName);
joint = daeSafeCast<domNode>(resolver.getElement());
if (joint)
break;
}
}
else {
// Search for the node from the root level
daeSIDResolver resolver(skin->getDocument()->getDomRoot(), jointName);
joint = daeSafeCast<domNode>(resolver.getElement());
}
if (!joint) {
daeErrorHandler::get()->handleWarning(avar("Failed to find bone '%s', "
"defaulting to instance_controller parent node '%s'", jointName, appNode->getName()));
joint = appNode->getDomNode();
}
bones[iJoint] = new ColladaAppNode(joint);
initialTransforms[iJoint] = objectOffset;
// Bone scaling is generally ignored during import, since 3space only
// stores default node transform and rotation. Compensate for this by
// removing the scaling from the inverse bind transform as well
MatrixF invBind = streams.invBindMatrices.getMatrixFValue(iJoint);
if (!ColladaUtils::getOptions().ignoreNodeScale)
{
Point3F invScale = invBind.getScale();
invScale.x = invScale.x ? (1.0f / invScale.x) : 0;
invScale.y = invScale.y ? (1.0f / invScale.y) : 0;
invScale.z = invScale.z ? (1.0f / invScale.z) : 0;
initialTransforms[iJoint].scale(invScale);
}
// Inverted node coordinate spaces (negative scale factor) are corrected
// in ColladaAppNode::getNodeTransform, so need to apply the same operation
// here to match
if (m_matF_determinant(invBind) < 0.0f)
initialTransforms[iJoint].scale(Point3F(1, 1, -1));
initialTransforms[iJoint].mul(invBind);
initialTransforms[iJoint].mul(bindShapeMatrix);
}
}