本文整理汇总了C++中PatchMesh::setPatchMtlIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ PatchMesh::setPatchMtlIndex方法的具体用法?C++ PatchMesh::setPatchMtlIndex怎么用?C++ PatchMesh::setPatchMtlIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PatchMesh
的用法示例。
在下文中一共展示了PatchMesh::setPatchMtlIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoAttach
//.........这里部分代码省略.........
{
attPatch->tvPatches[chan][i].tv[j] = v[ct - j - 1];
}
}
}
}
}
int i;
for (i = 0; i < attPatch->numVerts; ++i)
attPatch->verts[i].p = attPatch->verts[i].p * attMat;
for (i = 0; i < attPatch->numVecs; ++i)
attPatch->vecs[i].p = attPatch->vecs[i].p * attMat;
attPatch->computeInteriors();
theHold.Begin();
// Combine the materials of the two nodes.
int mat2Offset = 0;
Mtl *m1 = nodes[0]->GetMtl();
Mtl *m2 = node->GetMtl();
bool condenseMe = FALSE;
if (m1 && m2 &&(m1 != m2))
{
if (attachMat == ATTACHMAT_IDTOMAT)
{
int ct = 1;
if (m1->IsMultiMtl())
ct = m1->NumSubMtls();
for (int i = 0; i < patch->numPatches; ++i)
{
int mtid = patch->getPatchMtlIndex(i);
if (mtid >= ct)
patch->setPatchMtlIndex(i, mtid % ct);
}
FitPatchIDsToMaterial(*attPatch, m2);
if (condenseMat)
condenseMe = TRUE;
}
// the theHold calls here were a vain attempt to make this all undoable.
// This should be revisited in the future so we don't have to use the SYSSET_CLEAR_UNDO.
theHold.Suspend();
if (attachMat == ATTACHMAT_MATTOID)
{
m1 = FitMaterialToPatchIDs(*patch, m1);
m2 = FitMaterialToPatchIDs(*attPatch, m2);
}
Mtl *multi = CombineMaterials(m1, m2, mat2Offset);
if (attachMat == ATTACHMAT_NEITHER)
mat2Offset = 0;
theHold.Resume();
// We can't be in face subobject mode, else we screw up the materials:
DWORD oldSL = patch->selLevel;
DWORD roldSL = patch->selLevel;
patch->selLevel = PATCH_OBJECT;
rpatch->SetSelLevel (EP_OBJECT);
nodes[0]->SetMtl(multi);
patch->selLevel = oldSL;
rpatch->SetSelLevel (roldSL);
m1 = multi;
canUndo = FALSE; // Absolutely cannot undo material combinations.
}
if (!m1 && m2)
{
// We can't be in face subobject mode, else we screw up the materials:
示例2: BuildPatchFromShape
//.........这里部分代码省略.........
int baseVec2 = baseVec + segs * 2 * (levels + 1); // Base vector index for between levels
for(level = 0; level < levels; ++level) {
int sm = 0;
BOOL firstSmooth = (spline->GetLineType(0) == LTYPE_CURVE && spline->GetLineType(segs-1) == LTYPE_CURVE && (spline->GetKnotType(0) == KTYPE_AUTO || spline->GetKnotType(0) == KTYPE_BEZIER)) ? TRUE : FALSE;
for(seg = 0; seg < segs; ++seg, vec += 4) {
int prevseg = (seg + segs - 1) % segs;
int seg2 = (seg + 1) % knots;
int a,b,c,d,ab,ba,bc,cb,cd,dc,da,ad;
MtlID mtl = useShapeIDs ? spline->GetMatID(seg) : 2;
a = baseVert + seg;
b = baseVert + seg2;
c = b + knots;
d = a + knots;
ab = baseVec1 + seg * 2;
ba = ab + 1;
bc = baseVec2 + seg2 * 2;
cb = bc + 1;
cd = ba + (segs * 2);
dc = ab + (segs * 2);
da = baseVec2 + seg * 2 + 1;
ad = da - 1;
//DebugPrint(_T("Making patch %d: %d (%d %d) %d (%d %d) %d (%d %d) %d (%d %d)\n"),np, a, ab, ba, b, bc, cb, c, cd, dc, d, da, ad);
// If the vertex is not smooth, go to the next group!
if(seg > 0 && !(spline->GetLineType(prevseg) == LTYPE_CURVE && spline->GetLineType(seg) == LTYPE_CURVE && (spline->GetKnotType(seg) == KTYPE_AUTO || spline->GetKnotType(seg) == KTYPE_BEZIER))) {
sm++;
if(sm > 2)
sm = 1;
}
DWORD smoothGroup = 1 << sm;
if(seg == segs - 1 && firstSmooth) {
smoothGroup |= 1;
}
pmesh.MakeQuadPatch(np, a, ab, ba, b, bc, cb, c, cd, dc, d, da, ad, vec, vec+1, vec+2, vec+3, smooth ? smoothGroup : 0);
pmesh.setPatchMtlIndex(np++, genMatIDs ? mtl : 0);
}
baseVert += knots;
baseVec1 += (segs * 2);
baseVec2 += (knots * 2);
}
baseVert += knots;
baseVec += (segs * 2 * (levels + 1) + knots * 2 * levels);
}
assert(vec == nvecs);
assert(np == npatches);
// Maybe create the texture patches!
if(texturing) {
int ntp = 0;
int baseTVert = 0;
for(poly = 0; poly < polys; ++poly) {
Spline3D *spline = bShape.splines[poly];
if(!spline->KnotCount())
continue;
int pknots = spline->Segments() + 1;
int pverts = pknots * TVlevels;
int segs = spline->Segments();
for(level = 0; level < levels; ++level) {
for(seg = 0; seg < segs; ++seg) {
int prevseg = (seg + segs - 1) % segs;
int seg2 = seg + 1;
int a,b,c,d;
a = baseTVert + seg;
b = baseTVert + seg2;
c = b + pknots;
d = a + pknots;
TVPatch &tp = pmesh.getTVPatch(ntp++);