本文整理汇总了C++中PatchMesh::setNumMapVerts方法的典型用法代码示例。如果您正苦于以下问题:C++ PatchMesh::setNumMapVerts方法的具体用法?C++ PatchMesh::setNumMapVerts怎么用?C++ PatchMesh::setNumMapVerts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PatchMesh
的用法示例。
在下文中一共展示了PatchMesh::setNumMapVerts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModifyObject
//.........这里部分代码省略.........
tvVerts[j] = Point3(0.0f,0.0f,0.0f);
}
}
for (int j = 0; j < boneList[i]->weights.Count(); j++)
{
int vertIndex = boneList[i]->weights[j].vertIndex;
float vertWeight = boneList[i]->weights[j].vertWeight;
tvVerts[vertIndex][subID] = vertWeight;
}
}
}
else if (mesh)
{
int numMaps = mesh->getNumMaps();
int numGFaces = mesh->numFaces;
int numGVerts = mesh->numVerts;
numMaps = boneList.Count()/3+1;
mesh->setNumMaps(numMaps, FALSE);
for (int i = 0; i < boneList.Count(); i++)
{
int mapID = i/3;
int subID = i%3;
if (subID==0) //create our face data
{
mesh->setMapSupport(mapID);
mesh->setNumMapVerts(mapID,numGVerts);
}
TVFace *tvFace = mesh->mapFaces(mapID);
UVVert *tvVerts = mesh->mapVerts(mapID);
if (subID==0) //create our face data
{
//copy our original
//copy our geo faces to the texture faces
for (int j = 0; j < numGFaces; j++)
{
for (int k = 0; k < 3; k++)
{
tvFace[j].t[k] = mesh->faces[j].v[k];
}
}
for (int j = 0; j < numGVerts; j++)
{
tvVerts[j] = Point3(0.0f,0.0f,0.0f);
}
}
for (int j = 0; j < boneList[i]->weights.Count(); j++)
{
int vertIndex = boneList[i]->weights[j].vertIndex;
float vertWeight = boneList[i]->weights[j].vertWeight;
tvVerts[vertIndex][subID] = vertWeight;
}
示例2: ApplyMapping
void MeshTopoData::ApplyMapping(PatchMesh &patch, int mapChannel)
{
//get from mesh
if (!patch.getMapSupport(mapChannel) )
{
patch.setNumMaps (mapChannel+1);
}
TVPatch *tvFace = patch.tvPatches[mapChannel];
int tvFaceCount = patch.numPatches;
if (patch.selLevel!=PATCH_PATCH)
{
//copy into mesh struct
if (!tvFace)
{
// Create tvfaces and init to 0
patch.setNumMapPatches(mapChannel,patch.getNumPatches());
tvFace = patch.tvPatches[mapChannel];
for (int k=0; k<patch.getNumPatches(); k++)
{
for (int j=0; j<TVMaps.f[k]->count; j++)
{
tvFace[k].tv[j] = 0;
tvFace[k].interiors[j] = 0;
tvFace[k].handles[j*2] = 0;
tvFace[k].handles[j*2+1] = 0;
}
}
}
for (int k=0; k<tvFaceCount; k++)
{
if (k < TVMaps.f.Count())
{
tvFace[k].tv[0] = TVMaps.f[k]->t[0];
tvFace[k].tv[1] = TVMaps.f[k]->t[1];
tvFace[k].tv[2] = TVMaps.f[k]->t[2];
if (TVMaps.f[k]->count == 4) tvFace[k].tv[3] = TVMaps.f[k]->t[3];
if (TVMaps.f[k]->flags & FLAG_CURVEDMAPPING)
{
patch.patches[k].flags &= ~PATCH_LINEARMAPPING;
if (TVMaps.f[k]->vecs)
{
for (int m = 0;m < TVMaps.f[k]->count;m++)
{
if (TVMaps.f[k]->flags & FLAG_INTERIOR)
{
tvFace[k].interiors[m] = TVMaps.f[k]->vecs->interiors[m];
}
tvFace[k].handles[m*2] = TVMaps.f[k]->vecs->handles[m*2];
tvFace[k].handles[m*2+1] = TVMaps.f[k]->vecs->handles[m*2+1];
}
}
}
else patch.patches[k].flags |= PATCH_LINEARMAPPING;
}
else{
tvFace[k].tv[0] = 0;
tvFace[k].tv[1] = 0;
tvFace[k].tv[2] = 0;
if (TVMaps.f[k]->count == 4) tvFace[k].tv[3] = 0;
for (int m = 0;m < TVMaps.f[k]->count;m++)
{
tvFace[k].interiors[m] = 0;
tvFace[k].handles[m*2] = 0;
tvFace[k].handles[m*2+1] = 0;
}
}
}
//match verts
patch.setNumMapVerts (mapChannel,TVMaps.v.Count());
PatchTVert *tVerts = patch.tVerts[mapChannel];
for (int k=0; k<TVMaps.v.Count(); k++)
tVerts[k].p = GetTVVert(k);
}
else
{
//copy into mesh struct
if (!tvFace)
{
// Create tvfaces and init to 0
patch.setNumMapPatches (mapChannel,patch.getNumPatches());
tvFace = patch.tvPatches[mapChannel];
for (int k=0; k<patch.getNumPatches(); k++)
{
for (int j=0; j<TVMaps.f[k]->count; j++)
{
tvFace[k].tv[j] = 0;
//.........这里部分代码省略.........
示例3: ModifyObject
void MapChannelPaste::ModifyObject(TimeValue t, ModContext &mc, ObjectState * os, INode *node)
{
//TODO: Add the code for actually modifying the object
//get th map id
int mapID;
pblock->GetValue(pb_mapid,0,mapID,FOREVER);
mapID = buffer.pasteToChannel;
BOOL useMap;
pblock->GetValue(pb_usemap,0,useMap,FOREVER);
//get the mesh
Mesh *mesh = NULL;
MNMesh *mnmesh = NULL;
PatchMesh *pmesh = NULL;
TriObject *collapsedtobj = NULL;
if (os->obj->IsSubClassOf(triObjectClassID))
{
TriObject *tobj = (TriObject*)os->obj;
mesh = &tobj->GetMesh();
}
else if (os->obj->IsSubClassOf(polyObjectClassID))
{
PolyObject *pobj = (PolyObject*)os->obj;
mnmesh = &pobj->GetMesh();
}
#ifndef NO_PATCHES
else if (os->obj->IsSubClassOf(patchObjectClassID))
{
PatchObject *pobj = (PatchObject*)os->obj;
pmesh = &pobj->patch;
}
#endif // NO_PATCHES
// TriObject *tobj = (TriObject*)os->obj;
// Mesh &mesh = tobj->GetMesh();
if (pmesh)
{
if ( (buffer.numRealFaces == pmesh->numPatches) && (buffer.patchDeg.Count() == pmesh->numPatches) &&
((buffer.pasteToChannelType == PATCHMAPCHANNEL) || (buffer.pasteToChannelType == CHANNEL_MAP)))
{
BOOL gvalid = TRUE;
for (int i = 0; i < pmesh->numPatches; i++)
{
int sDeg, tDeg;
sDeg = buffer.patchDeg[i];
tDeg = 3;
if (pmesh->patches[i].type == PATCH_QUAD)
tDeg = 4;
if (tDeg != sDeg)
gvalid = FALSE;
}
if (gvalid)
{
if ((buffer.pasteToChannelType == PATCHMAPCHANNEL) || (buffer.pasteToChannelType == CHANNEL_MAP))
{
int numMaps = pmesh->getNumMaps();
BOOL clear = FALSE;
if (!pmesh->getMapSupport(mapID))
{
pmesh->setMapSupport(mapID, TRUE);
clear = TRUE;
}
//if last channel reduce the number of channels
if (buffer.pasteToSubID == -50)
pmesh->setNumMapVerts(mapID, buffer.verts.Count());
else pmesh->setNumMapVerts(mapID, buffer.w.Count());
PatchTVert *uvw = pmesh->mapVerts(mapID);
TVPatch *uvwFace = pmesh->tvPatches[mapID];//mesh->mapFaces(mapID);
int ct = buffer.verts.Count();
if (buffer.pasteToSubID != -50)
ct = buffer.w.Count();
for (int i = 0; i < ct; i++)
{
if (buffer.pasteToSubID == -50)
uvw[i] = buffer.verts[i];
else
{
if (clear)
uvw[i].p = Point3(0.0f,0.0f,0.0f);
uvw[i].p[buffer.pasteToSubID] = buffer.w[i];
}
}
for (int i = 0; i < buffer.numFaces; i++)
{
uvwFace[i] = buffer.uvwPatchFaces[i];
//.........这里部分代码省略.........