本文整理汇总了C++中UsdGeomPrimvar::SetInterpolation方法的典型用法代码示例。如果您正苦于以下问题:C++ UsdGeomPrimvar::SetInterpolation方法的具体用法?C++ UsdGeomPrimvar::SetInterpolation怎么用?C++ UsdGeomPrimvar::SetInterpolation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UsdGeomPrimvar
的用法示例。
在下文中一共展示了UsdGeomPrimvar::SetInterpolation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _addDisplayPrimvars
bool MayaMeshWriter::_addDisplayPrimvars(
UsdGeomGprim &primSchema,
const MFnMesh::MColorRepresentation colorRep,
const VtArray<GfVec3f>& RGBData,
const VtArray<float>& AlphaData,
const TfToken& interpolation,
const VtArray<int>& assignmentIndices,
const int unassignedValueIndex,
const bool clamped,
const bool authored)
{
// If we already have an authored value, don't try to write a new one.
UsdAttribute colorAttr = primSchema.GetDisplayColorAttr();
if (!colorAttr.HasAuthoredValueOpinion() && !RGBData.empty()) {
UsdGeomPrimvar displayColor = primSchema.CreateDisplayColorPrimvar();
if (interpolation != displayColor.GetInterpolation()) {
displayColor.SetInterpolation(interpolation);
}
displayColor.Set(RGBData);
if (!assignmentIndices.empty()) {
displayColor.SetIndices(assignmentIndices);
if (unassignedValueIndex != displayColor.GetUnauthoredValuesIndex()) {
displayColor.SetUnauthoredValuesIndex(unassignedValueIndex);
}
}
bool authRGB = authored;
if (colorRep == MFnMesh::kAlpha) {
authRGB = false;
}
if (authRGB) {
if (clamped) {
PxrUsdMayaRoundTripUtil::MarkPrimvarAsClamped(displayColor);
}
}
else {
PxrUsdMayaRoundTripUtil::MarkAttributeAsMayaGenerated(colorAttr);
}
}
UsdAttribute alphaAttr = primSchema.GetDisplayOpacityAttr();
if (!alphaAttr.HasAuthoredValueOpinion() && !AlphaData.empty()) {
// we consider a single alpha value that is 1.0 to be the "default"
// value. We only want to write values that are not the "default".
bool hasDefaultAlpha = AlphaData.size() == 1 && GfIsClose(AlphaData[0], 1.0, 1e-9);
if (!hasDefaultAlpha) {
UsdGeomPrimvar displayOpacity = primSchema.CreateDisplayOpacityPrimvar();
if (interpolation != displayOpacity.GetInterpolation()) {
displayOpacity.SetInterpolation(interpolation);
}
displayOpacity.Set(AlphaData);
if (!assignmentIndices.empty()) {
displayOpacity.SetIndices(assignmentIndices);
if (unassignedValueIndex != displayOpacity.GetUnauthoredValuesIndex()) {
displayOpacity.SetUnauthoredValuesIndex(unassignedValueIndex);
}
}
bool authAlpha = authored;
if (colorRep == MFnMesh::kRGB) {
authAlpha = false;
}
if (authAlpha) {
if (clamped) {
PxrUsdMayaRoundTripUtil::MarkPrimvarAsClamped(displayOpacity);
}
}
else {
PxrUsdMayaRoundTripUtil::MarkAttributeAsMayaGenerated(alphaAttr);
}
}
}
return true;
}