本文整理汇总了C++中PatchMesh::getNumTVerts方法的典型用法代码示例。如果您正苦于以下问题:C++ PatchMesh::getNumTVerts方法的具体用法?C++ PatchMesh::getNumTVerts怎么用?C++ PatchMesh::getNumTVerts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PatchMesh
的用法示例。
在下文中一共展示了PatchMesh::getNumTVerts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakePatchCapTexture
static void MakePatchCapTexture(PatchMesh &pmesh, Matrix3 &itm, int pstart, int pend, BOOL usePhysUVs) {
if(pstart == pend)
return;
// Find out which verts are used by the cap
BitArray capVerts(pmesh.numVerts);
capVerts.ClearAll();
for(int i = pstart; i < pend; ++i) {
Patch &p = pmesh.patches[i];
capVerts.Set(p.v[0]);
capVerts.Set(p.v[1]);
capVerts.Set(p.v[2]);
if(p.type == PATCH_QUAD)
capVerts.Set(p.v[3]);
}
// Minmax the verts involved in X/Y axis and total them
Box3 bounds;
int numCapVerts = 0;
int numCapPatches = pend - pstart;
IntTab capIndexes;
capIndexes.SetCount(pmesh.numVerts);
int baseTVert = pmesh.getNumTVerts();
for(int i = 0; i < pmesh.numVerts; ++i) {
if(capVerts[i]) {
capIndexes[i] = baseTVert + numCapVerts++;
bounds += pmesh.verts[i].p * itm;
}
}
pmesh.setNumTVerts(baseTVert + numCapVerts, TRUE);
Point3 s;
if (usePhysUVs)
s = Point3(1.0f, 1.0f, 0.0f);
else
s = Point3(1.0f / bounds.Width().x, 1.0f / bounds.Width().y, 0.0f);
Point3 t(-bounds.Min().x, -bounds.Min().y, 0.0f);
// Do the TVerts
for(int i = 0; i < pmesh.numVerts; ++i) {
if(capVerts[i])
pmesh.setTVert(baseTVert++, ((pmesh.verts[i].p * itm) + t) * s);
}
// Do the TVPatches
for(int i = pstart; i < pend; ++i) {
Patch &p = pmesh.patches[i];
TVPatch &tp = pmesh.getTVPatch(i);
if(p.type == PATCH_TRI)
tp.setTVerts(capIndexes[p.v[0]], capIndexes[p.v[1]], capIndexes[p.v[2]]);
else
tp.setTVerts(capIndexes[p.v[0]], capIndexes[p.v[1]], capIndexes[p.v[2]], capIndexes[p.v[3]]);
}
}