本文整理汇总了C++中PatchMesh::MakeQuadPatch方法的典型用法代码示例。如果您正苦于以下问题:C++ PatchMesh::MakeQuadPatch方法的具体用法?C++ PatchMesh::MakeQuadPatch怎么用?C++ PatchMesh::MakeQuadPatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PatchMesh
的用法示例。
在下文中一共展示了PatchMesh::MakeQuadPatch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildPatchFromShape
//.........这里部分代码省略.........
int baseVec1 = baseVec; // Base vector index for this level
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;