本文整理汇总了C++中TriObject::SetChannelValidity方法的典型用法代码示例。如果您正苦于以下问题:C++ TriObject::SetChannelValidity方法的具体用法?C++ TriObject::SetChannelValidity怎么用?C++ TriObject::SetChannelValidity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriObject
的用法示例。
在下文中一共展示了TriObject::SetChannelValidity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvertToType
Object* SimpleObject::ConvertToType(TimeValue t, Class_ID obtype)
{
if (obtype==defObjectClassID||obtype==triObjectClassID||obtype==mapObjectClassID) {
TriObject *triob;
UpdateMesh(t);
triob = CreateNewTriObject();
triob->GetMesh() = mesh;
triob->SetChannelValidity(TOPO_CHAN_NUM,ObjectValidity(t));
triob->SetChannelValidity(GEOM_CHAN_NUM,ObjectValidity(t));
return triob;
}
#ifndef NO_PATCHES
if (obtype == patchObjectClassID) {
UpdateMesh(t);
PatchObject *patchob = new PatchObject();
patchob->patch = mesh; // Handy Mesh->PatchMesh conversion
patchob->SetChannelValidity(TOPO_CHAN_NUM,ObjectValidity(t));
patchob->SetChannelValidity(GEOM_CHAN_NUM,ObjectValidity(t));
return patchob;
}
#endif
if (Object::CanConvertToType (obtype)) {
UpdateMesh (t);
return Object::ConvertToType(t,obtype);
}
if (CanConvertTriObject(obtype)) {
UpdateMesh (t);
TriObject *triob = CreateNewTriObject ();
triob->GetMesh() = mesh;
triob->SetChannelValidity(TOPO_CHAN_NUM,ObjectValidity(t));
triob->SetChannelValidity(GEOM_CHAN_NUM,ObjectValidity(t));
Object *ob = triob->ConvertToType (t, obtype);
if (ob != triob) triob->DeleteThis (); // (ob should never = tob.)
return ob;
}
return NULL;
}
示例2: ConvertToType
Object* bhkProxyObject::ConvertToType(TimeValue t, Class_ID obtype)
{
if (obtype == triObjectClassID)
{
int bvType = 0;
pblock2->GetValue(PB_BOUND_TYPE, 0, bvType, FOREVER, 0);
if (bvType != 0)
{
TriObject *ob = CreateNewTriObject();
#if VERSION_3DSMAX >= ((5000<<16)+(15<<8)+0) // Version 5+
ob->GetMesh().CopyBasics(proxyMesh);
#else
ob->GetMesh() = proxyMesh;
#endif
ob->SetChannelValidity(TOPO_CHAN_NUM,ObjectValidity(t));
ob->SetChannelValidity(GEOM_CHAN_NUM,ObjectValidity(t));
return ob;
}
}
return 0;
}
示例3: ConvertToType
Object* SimpleObject::ConvertToType(TimeValue t, Class_ID obtype)
{
if (obtype==defObjectClassID||obtype==triObjectClassID||obtype==mapObjectClassID) {
TriObject *triob;
UpdateMesh(t);
triob = CreateNewTriObject();
triob->GetMesh() = mesh;
triob->SetChannelValidity(TOPO_CHAN_NUM,ObjectValidity(t));
triob->SetChannelValidity(GEOM_CHAN_NUM,ObjectValidity(t));
return triob;
}
else
if (obtype == patchObjectClassID) {
UpdateMesh(t);
PatchObject *patchob = new PatchObject();
patchob->patch = mesh; // Handy Mesh->PatchMesh conversion
patchob->SetChannelValidity(TOPO_CHAN_NUM,ObjectValidity(t));
patchob->SetChannelValidity(GEOM_CHAN_NUM,ObjectValidity(t));
return patchob;
}
return Object::ConvertToType(t,obtype);
}
示例4: ModifyObject
void SmoothMod::ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node) {
Interval valid = FOREVER;
int autoSmooth, bits = 0, prevent = 0;
float thresh = 0.0f;
pblock->GetValue(sm_autosmooth, t, autoSmooth, valid);
if (autoSmooth) {
pblock->GetValue(sm_threshold, t, thresh, valid);
pblock->GetValue(sm_prevent_indirect, t, prevent, valid);
} else {
pblock->GetValue(sm_smoothbits, t, bits, valid);
}
// For version 4 and later, we process patch meshes as they are and pass them on. Earlier
// versions converted to TriMeshes (done below). For adding other new types of objects, add
// them here!
bool done = false;
#ifndef NO_PATCHES
if(version >= MATMOD_VER4 && os->obj->IsSubClassOf(patchObjectClassID)) {
PatchObject *patchOb = (PatchObject *)os->obj;
PatchMesh &pmesh = patchOb->GetPatchMesh(t);
BOOL useSel = pmesh.selLevel >= PO_PATCH;
if (autoSmooth) pmesh.AutoSmooth (thresh, useSel, prevent);
else {
for (int i=0; i<pmesh.getNumPatches(); i++) {
if (!useSel || pmesh.patchSel[i]) pmesh.patches[i].smGroup = (DWORD)bits;
}
}
pmesh.InvalidateGeomCache(); // Do this because there isn't a topo cache in PatchMesh
patchOb->UpdateValidity(TOPO_CHAN_NUM,valid);
done = true;
}
#endif // NO_PATCHES
if (!done && os->obj->IsSubClassOf (polyObjectClassID)) {
PolyObject *pPolyOb = (PolyObject *)os->obj;
MNMesh &mesh = pPolyOb->GetMesh();
BOOL useSel = (mesh.selLevel == MNM_SL_FACE);
if (autoSmooth) mesh.AutoSmooth (thresh, useSel, prevent);
else {
for (int faceIndex=0; faceIndex<mesh.FNum(); faceIndex++) {
if (!useSel || mesh.F(faceIndex)->GetFlag(MN_SEL)) {
mesh.F(faceIndex)->smGroup = (DWORD)bits;
}
}
}
// Luna task 747
// We need to rebuild the smoothing-group-based normals in the normalspec, if any:
if (mesh.GetSpecifiedNormals()) {
mesh.GetSpecifiedNormals()->SetParent (&mesh);
mesh.GetSpecifiedNormals()->BuildNormals ();
mesh.GetSpecifiedNormals()->ComputeNormals ();
}
pPolyOb->UpdateValidity(TOPO_CHAN_NUM,valid);
done = true;
}
TriObject *triOb = NULL;
if (!done) {
if (os->obj->IsSubClassOf(triObjectClassID)) triOb = (TriObject *)os->obj;
else {
// Convert to triobject if we can.
if(os->obj->CanConvertToType(triObjectClassID)) {
TriObject *triOb = (TriObject *)os->obj->ConvertToType(t, triObjectClassID);
// We'll need to stuff this back into the pipeline:
os->obj = triOb;
// Convert validities:
Interval objValid = os->obj->ChannelValidity (t, TOPO_CHAN_NUM);
triOb->SetChannelValidity (TOPO_CHAN_NUM, objValid);
triOb->SetChannelValidity (GEOM_CHAN_NUM,
objValid & os->obj->ChannelValidity (t, GEOM_CHAN_NUM));
triOb->SetChannelValidity (TEXMAP_CHAN_NUM,
objValid & os->obj->ChannelValidity (t, TEXMAP_CHAN_NUM));
triOb->SetChannelValidity (VERT_COLOR_CHAN_NUM,
objValid & os->obj->ChannelValidity (t, VERT_COLOR_CHAN_NUM));
triOb->SetChannelValidity (DISP_ATTRIB_CHAN_NUM,
objValid & os->obj->ChannelValidity (t, DISP_ATTRIB_CHAN_NUM));
}
}
}
if (triOb) { // one way or another, there's a triobject to smooth.
Mesh & mesh = triOb->GetMesh();
BOOL useSel = mesh.selLevel == MESH_FACE;
if (autoSmooth) mesh.AutoSmooth (thresh, useSel, prevent);
else {
for (int i=0; i<mesh.getNumFaces(); i++) {
if (!useSel || mesh.faceSel[i]) mesh.faces[i].smGroup = (DWORD)bits;
}
}
triOb->GetMesh().InvalidateTopologyCache();
triOb->UpdateValidity(TOPO_CHAN_NUM,valid);
}
}
示例5: ModifyObject
//.........这里部分代码省略.........
// Now process the edge vectors
work = nextVec;
max = rd->nbor[work].Count();
// Append the neighboring points
rd->MaybeAppendNeighbor(work, theVert, max);
rd->MaybeAppendNeighbor(work, theInterior, max);
rd->MaybeAppendNeighbor(work, prevVec, max);
rd->MaybeAppendNeighbor(work, nextVec2, max);
rd->MaybeAppendNeighbor(work, p.interior[(j+1)%p.type] + vecBase, max);
work = prevVec;
max = rd->nbor[work].Count();
// Append the neighboring points
rd->MaybeAppendNeighbor(work, theVert, max);
rd->MaybeAppendNeighbor(work, theInterior, max);
rd->MaybeAppendNeighbor(work, nextVec, max);
rd->MaybeAppendNeighbor(work, prevVec2, max);
rd->MaybeAppendNeighbor(work, p.interior[(j+p.type-1)%p.type] + vecBase, max);
// Now append the interior, if not auto
if(!p.IsAuto()) {
work = theInterior;
max = rd->nbor[work].Count();
// Append the neighboring points
rd->MaybeAppendNeighbor(work, p.v[j], max);
rd->MaybeAppendNeighbor(work, nextVec, max);
rd->MaybeAppendNeighbor(work, nextVec2, max);
rd->MaybeAppendNeighbor(work, prevVec, max);
rd->MaybeAppendNeighbor(work, prevVec2, max);
for(int k = 1; k < p.type; ++k)
rd->MaybeAppendNeighbor(work, p.interior[(j+k)%p.type] + vecBase, max);
}
}
}
// mjm - begin - 4.8.99
if (selLevel==PATCH_VERTEX) {
for (int i=0; i<pmesh.numVerts; ++i) {
if (pmesh.vertSel[i]) rd->sel.Set(i);
}
}
else if (selLevel==PATCH_OBJECT) rd->sel.SetAll();
// mjm - end
rd->ivalid = os->obj->ChannelValidity (t, TOPO_CHAN_NUM);
rd->ivalid &= os->obj->ChannelValidity (t, SUBSEL_TYPE_CHAN_NUM);
rd->ivalid &= os->obj->ChannelValidity (t, SELECT_CHAN_NUM);
}
Tab<float> vangles;
if (saddle) vangles.SetCount (rd->vnum);
Point3 *hold = new Point3[rd->vnum];
int act;
for (int k=0; k<iter; k++) {
for (i=0; i<rd->vnum; i++) hold[i] = patchObj->GetPoint(i);
if (saddle)
FindVertexAngles(pmesh, vangles.Addr(0));
for (i=0; i<rd->vnum; i++) {
// mjm - begin - 4.8.99
// if ((selLevel!=MESH_OBJECT) && (!rd->sel[i])) continue;
if ( (!rd->sel[i] ) && (!vsw || vsw[i] == 0) ) continue;
// mjm - end
if (saddle && (i < pmesh.numVerts) && (vangles[i] <= 2*PI*.99999f)) continue;
max = rd->nbor[i].Count();
if (boundary && !rd->fnum[i]) continue;
if (max<1)
continue;
Point3 avg(0.0f, 0.0f, 0.0f);
for (j=0,act=0; j<max; j++) {
act++;
avg += hold[rd->nbor[i][j]];
}
if (act<1)
continue;
// mjm - begin - 4.8.99
wtdRelax = (!rd->sel[i]) ? relax * vsw[i] : relax;
patchObj->SetPoint (i, hold[i]*(1-wtdRelax) + avg*wtdRelax/((float)act));
// patchObj->SetPoint (i, hold[i]*(1-relax) + avg*relax/((float)act));
// mjm - end
}
}
delete [] hold;
patchObj->patch.computeInteriors();
patchObj->patch.ApplyConstraints();
}
#endif // NO_PATCHES
if(!converted) {
os->obj->SetChannelValidity(GEOM_CHAN_NUM, valid);
} else {
// Stuff converted object into the pipeline!
triObj->SetChannelValidity(TOPO_CHAN_NUM, valid);
triObj->SetChannelValidity(GEOM_CHAN_NUM, valid);
triObj->SetChannelValidity(TEXMAP_CHAN_NUM, valid);
triObj->SetChannelValidity(MTL_CHAN_NUM, valid);
triObj->SetChannelValidity(SELECT_CHAN_NUM, valid);
triObj->SetChannelValidity(SUBSEL_TYPE_CHAN_NUM, valid);
triObj->SetChannelValidity(DISP_ATTRIB_CHAN_NUM, valid);
os->obj = triObj;
}
}
示例6: ModifyObject
void ExtrudeMod::ModifyObject(TimeValue t, ModContext &mc, ObjectState * os, INode *node)
{
//DebugPrint(_T("Extrude modifying object\n"));
// Get our personal validity interval...
Interval valid = GetValidity(t);
// and intersect it with the channels we use as input (see ChannelsUsed)
valid &= os->obj->ChannelValidity(t,TOPO_CHAN_NUM);
valid &= os->obj->ChannelValidity(t,GEOM_CHAN_NUM);
int output;
pblock->GetValue(PB_OUTPUT, TimeValue(0), output, FOREVER);
switch (output) {
case NURBS_OUTPUT:
#ifndef NO_NURBS
{
// Here is where all the fun stuff happens -- GenerateExtrudeSurface fills in the EM,
// then we stuff the EditableSurface into the pipeline.
ShapeObject *shape = (ShapeObject *)os->obj;
float amount;
BOOL texturing, genMatIds, useShapeIDs;
pblock->GetValue(PB_MAPPING, TimeValue(0), texturing, FOREVER);
pblock->GetValue(PB_GEN_MATIDS, TimeValue(0), genMatIds, FOREVER);
pblock->GetValue(PB_USE_SHAPEIDS, TimeValue(0), useShapeIDs, FOREVER);
int levels,capStart,capEnd,capType;
pblock->GetValue(PB_SEGS,t,levels,FOREVER);
if (levels<1) levels = 1;
pblock->GetValue(PB_CAPSTART,t,capStart,FOREVER);
pblock->GetValue(PB_CAPEND,t,capEnd,FOREVER);
pblock->GetValue(PB_CAPTYPE,t,capType,FOREVER);
pblock->GetValue(PB_AMOUNT,t,amount,FOREVER);
LimitValue(amount, -1000000.0f, 1000000.0f);
BOOL suspended = FALSE;
if (theHold.Holding()) {
theHold.Suspend();
suspended = TRUE;
}
Object *nobj = CreateNURBSExtrudeShape(ip, GetString(IDS_RB_EXTRUDE), t, shape, amount,
capStart, capEnd, capType, texturing, genMatIds, useShapeIDs);
if (suspended) {
theHold.Resume();
}
// We only set geom validity because we preserve animation on clone
// and copying other cahnnels causes problems -- SCM 9/2/97
nobj->SetChannelValidity(GEOM_CHAN_NUM, valid);
os->obj = nobj;
break;}
#endif
#ifndef NO_PATCHES
case PATCH_OUTPUT: {
// Here is where all the fun stuff happens -- BuildPatchFromShape fills in the PatchObject's patch mesh,
// then we stuff the PatchObject into the pipeline.
PatchObject *pat = new PatchObject;
BuildPatchFromShape(t, mc, os, pat->patch);
pat->SetChannelValidity(TOPO_CHAN_NUM, valid);
pat->SetChannelValidity(GEOM_CHAN_NUM, valid);
pat->SetChannelValidity(TEXMAP_CHAN_NUM, valid);
pat->SetChannelValidity(MTL_CHAN_NUM, valid);
pat->SetChannelValidity(SELECT_CHAN_NUM, valid);
pat->SetChannelValidity(SUBSEL_TYPE_CHAN_NUM, valid);
pat->SetChannelValidity(DISP_ATTRIB_CHAN_NUM, valid);
os->obj = pat;
break;}
#endif // NO_PATCHES
case MESH_OUTPUT: {
// Here is where all the fun stuff happens -- BuildMeshFromShape fills in the TriObject's mesh,
// then we stuff the TriObj into the pipeline.
TriObject *tri = CreateNewTriObject();
BuildMeshFromShape(t, mc, os, tri->GetMesh());
tri->SetChannelValidity(TOPO_CHAN_NUM, valid);
tri->SetChannelValidity(GEOM_CHAN_NUM, valid);
tri->SetChannelValidity(TEXMAP_CHAN_NUM, valid);
tri->SetChannelValidity(MTL_CHAN_NUM, valid);
tri->SetChannelValidity(SELECT_CHAN_NUM, valid);
tri->SetChannelValidity(SUBSEL_TYPE_CHAN_NUM, valid);
tri->SetChannelValidity(DISP_ATTRIB_CHAN_NUM, valid);
os->obj = tri;
break; }
#ifdef XXDESIGN_VER
case AMSOLID_OUTPUT: {
//Create an extrusion solid using Facet Modeler
Object* solid = (Object*)CreateInstance(GEOMOBJECT_CLASS_ID, GENERIC_AMSOLID_CLASS_ID);
assert(solid);
if(solid)
{
IGeomImp* cacheptr = (IGeomImp*)(solid->GetInterface(I_GEOMIMP));
assert(cacheptr);
//.........这里部分代码省略.........