本文整理汇总了C++中PatchObject::UpdateValidity方法的典型用法代码示例。如果您正苦于以下问题:C++ PatchObject::UpdateValidity方法的具体用法?C++ PatchObject::UpdateValidity怎么用?C++ PatchObject::UpdateValidity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PatchObject
的用法示例。
在下文中一共展示了PatchObject::UpdateValidity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModifyObject
void MatMod::ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node)
{
Interval valid = FOREVER;
int id;
pblock->GetValue(PB_MATID,t,id,valid);
id--;
if (id<0) id = 0;
if (id>0xffff) id = 0xffff;
// For version 4 and later, we process patch meshes as they are and pass them on. Earlier
// versions converted to TriMeshes (done below). For adding other new types of objects, add
// them here!
#ifndef NO_PATCHES
if(version >= MATMOD_VER4 && os->obj->IsSubClassOf(patchObjectClassID)) {
PatchObject *patchOb = (PatchObject *)os->obj;
PatchMesh &pmesh = patchOb->GetPatchMesh(t);
BOOL useSel = pmesh.selLevel >= PO_PATCH;
for (int i=0; i<pmesh.getNumPatches(); i++) {
if (!useSel || pmesh.patchSel[i]) {
pmesh.setPatchMtlIndex(i,(MtlID)id);
}
}
pmesh.InvalidateGeomCache(); // Do this because there isn't a topo cache in PatchMesh
patchOb->UpdateValidity(TOPO_CHAN_NUM,valid);
}
else
#endif // NO_PATCHES
// Process PolyObjects
if(os->obj->IsSubClassOf(polyObjectClassID)) {
PolyObject *polyOb = (PolyObject *)os->obj;
MNMesh &mesh = polyOb->GetMesh();
BOOL useSel = mesh.selLevel == MNM_SL_FACE;
for (int i=0; i<mesh.numf; i++) {
if (!useSel || mesh.f[i].GetFlag(MN_SEL)) {
mesh.f[i].material = (MtlID)id;
}
}
polyOb->UpdateValidity(TOPO_CHAN_NUM,valid);
}
else // If it's a TriObject, process it
if(os->obj->IsSubClassOf(triObjectClassID)) {
TriObject *triOb = (TriObject *)os->obj;
DoMaterialSet(triOb, id);
triOb->UpdateValidity(TOPO_CHAN_NUM,valid);
}
else // Fallback position: If it can convert to a TriObject, do it!
if(os->obj->CanConvertToType(triObjectClassID)) {
TriObject *triOb = (TriObject *)os->obj->ConvertToType(t, triObjectClassID);
// Now stuff this into the pipeline!
os->obj = triOb;
DoMaterialSet(triOb, id);
triOb->UpdateValidity(TOPO_CHAN_NUM,valid);
}
else
return; // Do nothing if it can't convert to triObject
}