本文整理汇总了C++中PatchMesh::InvalidateMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ PatchMesh::InvalidateMesh方法的具体用法?C++ PatchMesh::InvalidateMesh怎么用?C++ PatchMesh::InvalidateMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PatchMesh
的用法示例。
在下文中一共展示了PatchMesh::InvalidateMesh方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetRenderMesh
Mesh* TriPatchObject::GetRenderMesh(TimeValue t, INode *inode, View& view, BOOL& needDelete) {
UpdatePatchMesh(t);
TessApprox tess = patch.GetProdTess();
if (tess.type == TESS_SET) {
needDelete = FALSE;
patch.InvalidateMesh(); // force this...
// temporarlily set the view tess to prod tess
TessApprox tempTess = patch.GetViewTess();
patch.SetViewTess(tess);
PrepareMesh(t);
patch.SetViewTess(tempTess);
return &patch.GetMesh();
} else {
Mesh *nmesh = new Mesh/*(mesh)*/;
Matrix3 otm = inode->GetObjectTM(t);
Box3 bbox;
GetDeformBBox(t, bbox);
tess.merge *= Length(bbox.Width())/1000.0f;
TessApprox disp = patch.GetDispTess();
disp.merge *= Length(bbox.Width())/1000.0f;
GetGTessFunction();
(*psGTessFunc)(&patch, BEZIER_PATCH, &otm, nmesh, &tess, &disp, &view, inode->GetMtl(), FALSE, FALSE);
if (tess.merge > 0.0f && patch.GetProdTessWeld())
WeldMesh(nmesh, tess.merge);
needDelete = TRUE;
return nmesh;
}
}
示例2: BuildPatch
void TriPatchObject::BuildPatch(TimeValue t,PatchMesh& amesh)
{
int nverts = 4;
int nvecs = 16;
float l, w;
int tex;
// Start the validity interval at forever and whittle it down.
ivalid = FOREVER;
pblock->GetValue( PB_LENGTH, t, l, ivalid );
pblock->GetValue( PB_WIDTH, t, w, ivalid );
pblock->GetValue( PB_TEXTURE, t, tex, ivalid );
amesh.setNumVerts(nverts);
amesh.setNumTVerts(tex ? nverts : 0);
amesh.setNumVecs(nvecs);
amesh.setNumPatches(2);
amesh.setNumTVPatches(tex ? 2 : 0);
Point3 v0 = Point3(-w, -l, 0.0f) / 2.0f;
Point3 v1 = v0 + Point3(w, 0.0f, 0.0f);
Point3 v2 = v0 + Point3(w, l, 0.0f);
Point3 v3 = v0 + Point3(0.0f, l, 0.0f);
// Create the vertices.
amesh.verts[0].flags = PVERT_COPLANAR;
amesh.verts[1].flags = PVERT_COPLANAR;
amesh.verts[2].flags = PVERT_COPLANAR;
amesh.verts[3].flags = PVERT_COPLANAR;
if(tex) {
amesh.setTVert(0, UVVert(0,0,0));
amesh.setTVert(1, UVVert(1,0,0));
amesh.setTVert(2, UVVert(1,1,0));
amesh.setTVert(3, UVVert(0,1,0));
}
amesh.setVert(0, v0);
amesh.setVert(1, v1);
amesh.setVert(2, v2);
amesh.setVert(3, v3);
// Create the vectors
MAKEVEC(0, v0, v1);
MAKEVEC(2, v1, v2);
MAKEVEC(4, v2, v3);
MAKEVEC(6, v3, v0);
MAKEVEC(8, v3, v1);
// Create patches.
amesh.MakeTriPatch(0, 0, 0, 1, 1, 9, 8, 3, 6, 7, 10, 11, 12, 1);
amesh.MakeTriPatch(1, 1, 2, 3, 2, 4, 5, 3, 8, 9, 13, 14, 15, 1);
Patch &p1 = amesh.patches[0];
Patch &p2 = amesh.patches[1];
if(tex) {
amesh.getTVPatch(0).setTVerts(0,1,3);
amesh.getTVPatch(1).setTVerts(1,2,3);
}
// Finish up patch internal linkages (and bail out if it fails!)
assert(amesh.buildLinkages());
// Calculate the interior bezier points on the PatchMesh's patches
amesh.computeInteriors();
amesh.InvalidateGeomCache();
// Tell the PatchMesh it just got changed
amesh.InvalidateMesh();
}