本文整理汇总了C++中TriObject::PointsWereChanged方法的典型用法代码示例。如果您正苦于以下问题:C++ TriObject::PointsWereChanged方法的具体用法?C++ TriObject::PointsWereChanged怎么用?C++ TriObject::PointsWereChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriObject
的用法示例。
在下文中一共展示了TriObject::PointsWereChanged方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModifyObject
void OptMod::ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node)
{
float faceThresh, edgeThresh, bias, maxEdge;
int preserveMat, preserveSmooth, which, render=0, autoEdge;
DWORD flags = 0;
Interval valid = FOREVER;
int nv,nf;
int man;
pblock->GetValue(PB_MANUPDATE,t,man,valid);
if (man && !forceUpdate && !TestAFlag(A_RENDER)) return;
forceUpdate = FALSE;
if (TestAFlag(A_RENDER)) {
pblock->GetValue(PB_RENDER,t,which,valid);
} else {
pblock->GetValue(PB_VIEWS,t,which,valid);
}
pblock->GetValue(PB_AUTOEDGE,t,autoEdge,valid);
if (which==0) {
pblock->GetValue(PB_FACETHRESH1,t,faceThresh,valid);
pblock->GetValue(PB_EDGETHRESH1,t,edgeThresh,valid);
pblock->GetValue(PB_BIAS1,t,bias,valid);
pblock->GetValue(PB_PRESERVEMAT1,t,preserveMat,valid);
pblock->GetValue(PB_PRESERVESMOOTH1,t,preserveSmooth,valid);
pblock->GetValue(PB_MAXEDGE1,t,maxEdge,valid);
} else {
pblock->GetValue(PB_FACETHRESH2,t,faceThresh,valid);
pblock->GetValue(PB_EDGETHRESH2,t,edgeThresh,valid);
pblock->GetValue(PB_BIAS2,t,bias,valid);
pblock->GetValue(PB_PRESERVEMAT2,t,preserveMat,valid);
pblock->GetValue(PB_PRESERVESMOOTH2,t,preserveSmooth,valid);
pblock->GetValue(PB_MAXEDGE2,t,maxEdge,valid);
}
assert(os->obj->IsSubClassOf(triObjectClassID));
TriObject *triOb = (TriObject *)os->obj;
nv = triOb->GetMesh().getNumVerts();
nf = triOb->GetMesh().getNumFaces();
if (preserveMat) flags |= OPTIMIZE_SAVEMATBOUNDRIES;
if (preserveSmooth) flags |= OPTIMIZE_SAVESMOOTHBOUNDRIES;
if (autoEdge) flags |= OPTIMIZE_AUTOEDGE;
if (faceThresh!=0.0f) {
GetAsyncKeyState(VK_ESCAPE); // clear the state
HCURSOR hCur;
if (nf > 2000) hCur = SetCursor(LoadCursor(NULL,IDC_WAIT));
triOb->GetMesh().Optimize(
faceThresh,edgeThresh, bias*0.5f, maxEdge, flags,this);
if (nf > 200) SetCursor(hCur);
}
triOb->GetMesh().InvalidateTopologyCache ();
triOb->PointsWereChanged();
triOb->UpdateValidity(GEOM_CHAN_NUM,valid);
triOb->UpdateValidity(TOPO_CHAN_NUM,valid);
triOb->UpdateValidity (TEXMAP_CHAN_NUM, valid);
triOb->UpdateValidity (VERT_COLOR_CHAN_NUM, valid);
if (pmapParam && pmapParam->GetParamBlock()==pblock && !TestAFlag(A_RENDER)) {
TSTR buf;
buf.printf("%d / %d",nv,triOb->GetMesh().getNumVerts());
SetWindowText(GetDlgItem(pmapParam->GetHWnd(),IDC_OPT_VERTCOUNT),buf);
buf.printf("%d / %d",nf,triOb->GetMesh().getNumFaces());
SetWindowText(GetDlgItem(pmapParam->GetHWnd(),IDC_OPT_FACECOUNT),buf);
}
}
示例2: ModifyObject
void BombMod::ModifyObject(
TimeValue t, ModContext &mc, ObjectState *os, INode *node)
{
BombObject *bobj = GetWSMObject(t);
if (bobj && nodeRef && (bobj->ClassID() == Class_ID(BOMB_OBJECT_CLASS_ID,0))) {
assert(os->obj->IsSubClassOf(triObjectClassID));
TriObject *triOb = (TriObject *)os->obj;
Interval valid = FOREVER;
if (os->GetTM()) {
Matrix3 tm = *(os->GetTM());
for (int i=0; i<triOb->GetMesh().getNumVerts(); i++) {
triOb->GetMesh().verts[i] = triOb->GetMesh().verts[i] * tm;
}
os->obj->UpdateValidity(GEOM_CHAN_NUM,os->tmValid());
os->SetTM(NULL,FOREVER);
}
if (waitPostLoad) {
valid.SetInstant(t);
triOb->UpdateValidity(GEOM_CHAN_NUM,valid);
triOb->UpdateValidity(TOPO_CHAN_NUM,valid);
return;
}
Matrix3 tm;
TimeValue det = bobj->GetDetonation(t,valid);
float strength = bobj->GetStrength(t,valid) * STRENGTH_CONSTANT;
float grav = bobj->GetGravity(t,valid);
float chaos = bobj->GetChaos(t,valid);
float chaosBase = (float(1)-chaos/2);
float rotSpeed = bobj->GetSpin(t,valid) * TWOPI/float(TIME_TICKSPERSEC);
int minClust = bobj->GetMinFrag(t,valid), maxClust = bobj->GetMaxFrag(t,valid);
if (minClust<1) minClust = 1;
if (maxClust<1) maxClust = 1;
int clustVar = maxClust-minClust+1;
float falloff = bobj->GetFalloff(t,valid);
int useFalloff = bobj->GetFalloffOn(t,valid);
int seed = bobj->GetSeed(t,valid);
//tm = nodeRef->GetNodeTM(t,&valid);
tm = nodeRef->GetObjectTM(t,&valid);
if (t<det) {
valid.Set(TIME_NegInfinity,det-1);
triOb->UpdateValidity(GEOM_CHAN_NUM,valid);
triOb->UpdateValidity(TOPO_CHAN_NUM,valid);
triOb->PointsWereChanged();
return;
}
float dt = float(t-det);
valid.SetInstant(t);
int n0=0,n1=1,n2=2,nv;
Point3 v, p0, p1, g(0.0f,0.0f,grav*GRAVITY_CONSTANT);
Tab<Point3> l_newVerts ;
Face *f = triOb->GetMesh().faces;
float dot;
Mesh &mesh = triOb->GetMesh();
// First, segment the faces.
srand((unsigned int)seed);
Tab<DWORD> vclust;
Tab<DWORD> vmap;
Tab<Point3> nverts;
vclust.SetCount(mesh.getNumVerts());
vmap.SetCount(mesh.getNumVerts());
int numClust = 0;
if (minClust==1 && maxClust==1) {
// Simple case... 1 face per cluster
nv = triOb->GetMesh().getNumFaces() * 3;
l_newVerts.SetCount(nv);
vclust.SetCount(nv);
for (int i=0; i<nv; i++) {
vclust[i] = i/3;
}
for (int i=0,j=0; i<mesh.getNumFaces(); i++) {
l_newVerts[j] = mesh.verts[mesh.faces[i].v[0]];
l_newVerts[j+1] = mesh.verts[mesh.faces[i].v[1]];
l_newVerts[j+2] = mesh.verts[mesh.faces[i].v[2]];
mesh.faces[i].v[0] = j;
mesh.faces[i].v[1] = j+1;
mesh.faces[i].v[2] = j+2;
j += 3;
}
numClust = triOb->GetMesh().getNumFaces();
} else {
// More complex case... clusters are randomely sized
for (int i=0; i<mesh.getNumVerts(); i++) {
vclust[i] = UNDEFINED;
vmap[i] = i;
}
int cnum = 0;
for (int i=0; i<mesh.getNumFaces(); ) {
int csize = int(Rand1()*float(clustVar)+float(minClust));
//.........这里部分代码省略.........