本文整理汇总了C++中TriObject::GetPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ TriObject::GetPoint方法的具体用法?C++ TriObject::GetPoint怎么用?C++ TriObject::GetPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriObject
的用法示例。
在下文中一共展示了TriObject::GetPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createShape
//.........这里部分代码省略.........
{
MaxMsgBox(NULL, _T("Error: convex shape proxy not supported (yet)"), _T("Error"), MB_OK);
//d->meshData = MxUtils::nodeToNxConvexMesh(proxyMesh);
//Matrix3 pose = nodePose * actorNode->PhysicsNodePoseTMInv;
//d->localPose = MxMathUtils::MaxMatrixToNx(pose);
}
else
{
if(node->SimpleMesh.numFaces > 255)
{
MaxMsgBox(NULL, _T("Error: number of vertices in a convex shape should be less than 256"), _T("Error"), MB_OK);
//warning/Error
} else
{
BOOL needDel = FALSE;
TriObject* tri = MxUtils::GetTriObjectFromNode(node->GetMaxNode(),0.f,needDel);
if (tri)
{
int numVerts = tri->NumPoints();
btConvexHullShape* convexHull = new btConvexHullShape();
//for center of mass computation, simplify and assume mass is at the vertices
btCompoundShape* compound = new btCompoundShape();
btSphereShape sphere(0.1);
btTransform tr;
tr.setIdentity();
btAlignedObjectArray<btScalar> masses;
btScalar childMass = actorDesc.mass/(btScalar)numVerts;
for (int i=0;i<numVerts;i++)
{
btVector3 pt(tri->GetPoint(i).x,tri->GetPoint(i).y,tri->GetPoint(i).z);
convexHull->addPoint(pt);
tr.setOrigin(pt);
compound->addChildShape(tr,&sphere);
masses.push_back(childMass);
}
btTransform principal;
btVector3 inertia;
compound->calculatePrincipalAxisTransform(&masses[0],principal,inertia);
delete compound;
btTransform principalInv = principal.inverse();
compound = new btCompoundShape();
compound->addChildShape(principalInv,convexHull);
shape = compound;
Matrix3 offset;
bullet2Max(principal,offset);
actorDesc.localPose = actorDesc.localPose * offset;
if (needDel)
delete tri;
}
}
//d->meshData = MxUtils::nodeToNxConvexMesh(node->SimpleMesh);
//Matrix3 pose = nodePose * actorNode->PhysicsNodePoseTMInv;
示例2: ModifyObject
//.........这里部分代码省略.........
if ((selLevel==MESH_FACE) && mesh->faceSel[i]) rd->sel.Set(v[j]);
if ((selLevel==MESH_EDGE) && mesh->edgeSel[i*3+j]) rd->sel.Set(v[j]);
if ((selLevel==MESH_EDGE) && mesh->edgeSel[i*3+(j+2)%3]) rd->sel.Set(v[j]);
origmax = max = rd->nbor[v[j]].Count();
rd->fnum[v[j]]++;
for (k1=0; k1<max; k1++) if (rd->nbor[v[j]][k1] == v[(j+1)%3]) break;
if (k1==max) { rd->nbor[v[j]].Append (1, v+(j+1)%3, 1); max++; }
for (k2=0; k2<max; k2++) if (rd->nbor[v[j]][k2] == v[(j+2)%3]) break;
if (k2==max) { rd->nbor[v[j]].Append (1, v+(j+2)%3, 1); max++; }
if (max>origmax) rd->vis[v[j]].SetSize (max, TRUE);
if (mesh->faces[i].getEdgeVis (j)) rd->vis[v[j]].Set (k1);
else if (k1>=origmax) rd->vis[v[j]].Clear (k1);
if (mesh->faces[i].getEdgeVis ((j+2)%3)) rd->vis[v[j]].Set (k2);
else if (k2>= origmax) rd->vis[v[j]].Clear (k2);
}
}
// mjm - begin - 4.8.99
// if (selLevel==MESH_VERTEX) rd->sel = mesh->vertSel;
if (selLevel==MESH_VERTEX)
rd->sel = mesh->vertSel;
else if (selLevel==MESH_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] = triObj->GetPoint(i);
if (saddle) mesh->FindVertexAngles (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 && (vangles[i] <= 2*PI*.99999f)) continue;
max = rd->nbor[i].Count();
if (boundary && (rd->fnum[i] < max)) continue;
if (max<1) continue;
Point3 avg(0.0f, 0.0f, 0.0f);
for (j=0,act=0; j<max; j++) {
if (!rd->vis[i][j]) continue;
act++;
avg += hold[rd->nbor[i][j]];
}
if (act<1) continue;
// mjm - begin - 4.8.99
wtdRelax = (!rd->sel[i]) ? relax * vsw[i] : relax;
triObj->SetPoint (i, hold[i]*(1-wtdRelax) + avg*wtdRelax/((float)act));
// triObj->SetPoint (i, hold[i]*(1-relax) + avg*relax/((float)act));
// mjm - end
}
}
delete [] hold;
}
if (polyObj) {
int i, j, max;
MNMesh & mm = polyObj->mm;
float *vsw = (mm.selLevel!=MNM_SL_OBJECT) ? mm.getVSelectionWeights() : NULL;
示例3: mirrorPhysiqueSelection
bool CExportNel::mirrorPhysiqueSelection(INode &node, TimeValue tvTime, const std::vector<uint> &vertIn,
float threshold)
{
bool ok;
uint i;
// no vertices selected?
if(vertIn.empty())
return true;
// **** Get all the skeleton node
std::vector<INode*> skeletonNodes;
INode *skelRoot= getSkeletonRootBone(node);
if(!skelRoot)
return false;
getObjectNodes(skeletonNodes, tvTime, skelRoot);
// **** Build the Vector (world) part
std::vector<CTempSkinVertex> tempVertex;
uint vertCount;
// Get a pointer on the object's node.
ObjectState os = node.EvalWorldState(tvTime);
Object *obj = os.obj;
// Check if there is an object
ok= false;
if (obj)
{
// Object can be converted in triObject ?
if (obj->CanConvertToType(Class_ID(TRIOBJ_CLASS_ID, 0)))
{
// Get a triobject from the node
TriObject *tri = (TriObject*)obj->ConvertToType(tvTime, Class_ID(TRIOBJ_CLASS_ID, 0));
if (tri)
{
// Note that the TriObject should only be deleted
// if the pointer to it is not equal to the object
// pointer that called ConvertToType()
bool deleteIt=false;
if (obj != tri)
deleteIt = true;
// Get the node matrix. TODO: Matrix headhache?
/*Matrix3 nodeMatrixMax;
CMatrix nodeMatrix;
getLocalMatrix (nodeMatrixMax, node, tvTime);
convertMatrix (nodeMatrix, nodeMatrixMax);*/
// retrive Position geometry
vertCount= tri->NumPoints();
tempVertex.resize(vertCount);
for(uint i=0;i<vertCount;i++)
{
Point3 v= tri->GetPoint(i);
tempVertex[i].Pos.set(v.x, v.y, v.z);
}
// Delete the triObject if we should...
if (deleteIt)
tri->MaybeAutoDelete();
tri = NULL;
// ok!
ok= true;
}
}
}
if(!ok)
return false;
// no vertices? abort
if(vertCount==0)
return true;
// **** Mark all Input vertices
for(i=0;i<vertIn.size();i++)
{
nlassert(vertIn[i]<vertCount);
tempVertex[vertIn[i]].Input= true;
}
// **** Build the output vertices
std::vector<uint> vertOut;
vertOut.reserve(tempVertex.size());
// Build the in bbox
CAABBox bbox;
bbox.setCenter(tempVertex[vertIn[0]].Pos);
for(i=0;i<vertIn.size();i++)
{
bbox.extend(tempVertex[vertIn[i]].Pos);
}
bbox.setHalfSize(bbox.getHalfSize()+CVector(threshold, threshold, threshold));
//.........这里部分代码省略.........