本文整理汇总了C++中Tab::ZeroCount方法的典型用法代码示例。如果您正苦于以下问题:C++ Tab::ZeroCount方法的具体用法?C++ Tab::ZeroCount怎么用?C++ Tab::ZeroCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tab
的用法示例。
在下文中一共展示了Tab::ZeroCount方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetComponents
bool GetComponents()
{
fSelectedNodes.ZeroCount();
fSharedComps.ZeroCount();
Interface *ip = GetCOREInterface();
int nodeCount = ip->GetSelNodeCount();
if (nodeCount == 0)
return false;
// Get the components shared among the selected nodes
int i;
fSelectedNodes.SetCount(nodeCount);
for (i = 0; i < nodeCount; i++)
fSelectedNodes[i] = ip->GetSelNode(i);
INodeTab sharedComps;
if (plSharedComponents(fSelectedNodes, sharedComps) == 0)
return false;
// Put the shared components in a list
fSharedComps.SetCount(sharedComps.Count());
for (i = 0; i < sharedComps.Count(); i++)
fSharedComps[i] = ((plMaxNode*)sharedComps[i])->ConvertToComponent();
return true;
}
示例2: ConvertSelectedToXrefScene
void Xrefutil::ConvertSelectedToXrefScene(HWND hWnd)
{
// *** ConvertSelectedToXrefScene ***
//
// Relatively simple -- take the selected nodes, save them out
// to a new .MAX file, delete the selected nodes from the
// current scene, and then do a RootNode->AddNewXRefFile
// with the just-saved MAX file.
INode * pNode = NULL;
TSTR filename = _T("");
int i;
INode * pRootNode = m_pInterface->GetRootNode();
if (!pRootNode) {
// well, this is actually _really_ bad, but we just exit
return;
}
if (m_pInterface->GetSelNodeCount() == 0) {
::MessageBox(hWnd, GetString(IDS_ERR3), ERROR_TITLE, MB_ICONSTOP | MB_OK);
return;
}
Tab<INode *> nodetab;
nodetab.ZeroCount();
nodetab.Shrink();
for (i = 0; i < m_pInterface->GetSelNodeCount(); i++) {
pNode = m_pInterface->GetSelNode(i);
nodetab.Append(1, &pNode, 5);
}
if (!DoOpenSaveDialog(filename)) {
// either cancel or fail, just return
return;
}
m_pInterface->FileSaveSelected(filename);
// delete selected nodes, don't refresh yet
for (i = 0; i < nodetab.Count(); i++) {
nodetab[i]->Delete(0,TRUE);
}
AssetUser asset = IAssetManager::GetInstance()->GetAsset(filename,kXRefAsset);
// add in the nodes we saved out as an xref'd scene
pRootNode->AddNewXRefFile(asset, TRUE);
m_pInterface->RedrawViews(m_pInterface->GetTime());
}
示例3: proc
void proc(INodeTab &nodeTab)
{
int i;
Tab<int> freeC;
freeC.ZeroCount();
// find available channels
for(i=0;i<100;i++)
{
int tI = i;
if(!mp->chanBank[i].mModded) freeC.Append(1,&tI,0);
}
// If there are less channels than incoming targets, tell the user and quit out
if(nodeTab.Count()>freeC.Count())
{
TSTR buf1(GetString(IDS_NOFREE));
TSTR buf2(GetString(IDS_CANNOT));
MessageBox(mp->hwChannelList,buf1,buf2,MB_ICONSTOP | MB_OK);
goto leapOut;
}
// Do the assignment of nodes
for(i=0;i<nodeTab.Count();i++)
{
UI_MAKEBUSY
if (theHold.Holding())
theHold.Put(new Restore_FullChannel(mp, i ));
mp->ReplaceReference(101+freeC[i],nodeTab[i]);
mp->chanBank[freeC[i]].buildFromNode(nodeTab[i]);
mp->chanBank[freeC[i]].ReNormalize();
UI_MAKEFREE
}
leapOut:
i=0;
}
示例4: EndEditParams
void bhkRigidBodyModifier::EndEditParams (IObjParam *ip,ULONG flags,Animatable *next)
{
Modifier::EndEditParams(ip,flags,next);
//saveState();
mNodes.ZeroCount();
mIP = NULL;
// NOTE: This flag must be cleared before sending the REFMSG_END_EDIT
ClearAFlag(A_MOD_BEING_EDITED);
TimeValue t = ip->GetTime();
NotifyDependents(Interval(t,t), PART_ALL, REFMSG_END_EDIT);
NotifyDependents(Interval(t,t), PART_ALL, REFMSG_MOD_DISPLAY_OFF);
havok_param_blk.SetUserDlgProc();
if (flags&END_EDIT_REMOVEUI) {
pmapParam = NULL;
UpdateBVDialogs();
}
// For PB2 we ask the ClassDesc2 to take care of the EndEditParams - NH
bhkRigidBodyModifierDesc.EndEditParams(ip,this,flags,next);
//EndEditRBParams(ip, flags, next);
}
示例5: BeginEditParams
void bhkRigidBodyModifier::BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev)
{
Modifier::BeginEditParams(ip, flags, prev);
mIP = ip;
TimeValue t = ip->GetTime();
NotifyDependents(Interval(t,t), PART_ALL, REFMSG_BEGIN_EDIT);
NotifyDependents(Interval(t,t), PART_ALL, REFMSG_MOD_DISPLAY_ON);
SetAFlag(A_MOD_BEING_EDITED);
bhkRigidBodyModifierDesc.BeginEditParams(ip,this,flags,prev);
havok_param_blk.SetUserDlgProc(havok_params, new bhkRigidBodyModifierDlgProc(this));
havok_param_blk.SetUserDlgProc(clone_params, new CloneMeshDlgProc(this));
havok_param_blk.SetUserDlgProc(subshape_params, new SubShapeDlgProc(this));
//pmapParam = pblock->GetMap(havok_params);
//UpdateBVDialogs();
//pmapParam->GetIRollup()->Hide(1);
//pmapParam->GetIRollup()->Hide(3);
// BeginEditRBParams(ip, flags, prev);
mNodes.ZeroCount();
}
示例6: EdgeListFromPoints
//.........这里部分代码省略.........
// int startingNumberProcessed = processedVerts.NumberSet();
int ct = ourConnects[currentVert]->connectingVerts.Count();
processedVerts.Set(currentVert, TRUE);
for (int j = 0; j < ct; j++)
{
int index = ourConnects[currentVert]->connectingVerts[j].vertexIndex;
if (index == target)
{
done = TRUE;
hit = TRUE;
}
if (!processedVerts[index])
vertsToDo.Append(1,&index, 10000);
}
if (vertsToDo.Count())
{
currentVert = vertsToDo[vertsToDo.Count()-1];
vertsToDo.Delete(vertsToDo.Count()-1,1);
}
if (vertsToDo.Count() == 0) done = TRUE;
// int endingNumberProcessed = processedVerts.NumberSet();
if (currentVert == target)
{
done = TRUE;
hit = TRUE;
}
// if (startingNumberProcessed == endingNumberProcessed)
// done = TRUE;
}
vertsToDo.ZeroCount();
if (hit)
{
Tab<VConnections*> solvedNodes;
ourConnects[source]->accumDist = 0;
VConnections* unsolvedNodeHead = ourConnects[source];
VConnections* unsolvedNodeCurrent = unsolvedNodeHead;
//put all our vertices in the unsolved list
for (int i = 0; i < ourConnects.Count(); i++)
{
if (ourConnects[i] != unsolvedNodeHead)
{
unsolvedNodeCurrent->linkedListChild = ourConnects[i];
VConnections *parent = unsolvedNodeCurrent;
unsolvedNodeCurrent = ourConnects[i];
unsolvedNodeCurrent->linkedListParent = parent;
}
}
//build our edge distances
Tab<float> edgeDistances;
edgeDistances.SetCount(gePtrList.Count());
for (int i = 0 ; i < gePtrList.Count(); i++)
{
int a = gePtrList[i]->a;
int b = gePtrList[i]->b;
float d = Length(geomPoints[a] - geomPoints[b]);
edgeDistances[i] = d;
示例7: switch
Tab<TSTR *> *GetRefName(RefMessage message,PartID& partID,BOOL bShowpartIDs) {
static TSTR *pMsgStr, MsgStr;
static Tab <TSTR *> pMessages;
pMsgStr = &MsgStr;
pMessages.ZeroCount();
switch (message) {
case 0x00000010:
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" REFMSG_LOOPTEST"));
break;
case 0x00000020:
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" REFMSG_TARGET_DELETED"));
break;
case 0x00000021:
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" REFMSG_MODAPP_DELETING"));
break;
case 0x00000030:
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR( _T(" REFMSG_EVAL"));
break;
case 0x00000040:
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR( _T(" REFMSG_RESET_ORIGIN"));
break;
case 0x00000050:
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T("REFMSG_CHANGE "));
if(bShowpartIDs)
{
if(partID&PART_TOPO)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_TOPO"));
}
if(partID&PART_GEOM)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_GEOM"));
}
if(partID&PART_TEXMAP)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_TEXMAP"));
}
if(partID&PART_MTL)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_MTL"));
}
if(partID&PART_SELECT)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_SELECT"));
}
if(partID&PART_SUBSEL_TYPE)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_SUBSEL_TYPE"));
}
if(partID&PART_DISPLAY)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_DISPLAY"));
}
if(partID&PART_VERTCOLOR)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_VERTCOLOR"));
}
if(partID&PART_GFX_DATA)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_GFX_DATA"));
}
if(partID&PART_TM_CHAN)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_TM_CHAN"));
}
if(partID&PART_MTL_CHAN)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_MTL_CHAN"));
}
if(partID&PART_OBJECT_TYPE)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_OBJECT_TYPE"));
}
if(partID&PART_HIDESTATE)
{
pMessages.SetCount(pMessages.Count() +1);
pMessages[pMessages.Count() -1] = new TSTR(_T(" PART_HIDESTATE"));
}
}
}
case 0x00000070:
//.........这里部分代码省略.........
示例8: BuildMesh
void ParticleMesherObject::BuildMesh(TimeValue t)
{
//check if render time
//get node
//mkae ivalid interesect with the
int isRendering = 0;
ivalid = FOREVER;
TimeValue offset;
float foffset;
Interval iv;
pblock2->GetValue(particlemesher_time, 0, foffset, iv);
foffset = -foffset;
pblock2->GetValue(particlemesher_radius, 0, radius, iv);
foffset *= GetTicksPerFrame();
offset = (TimeValue) foffset;
// pblock2->GetValue(particlemesher_time, 0, foffset, iv);
if ((lastTime == t) )
{
ivalid.Set(t,t);
return;
}
pblock2->GetValue(particlemesher_rendertimeonly, 0, isRendering, ivalid);
isRendering = !isRendering;
if ((isRendering) || (TestAFlag(A_RENDER)))
{
INode *node=NULL;
pblock2->GetValue(particlemesher_pick, 0, node, ivalid);
BOOL reevalGroup = FALSE;
if ((node != NULL) && (node->IsGroupHead()) )
{
for (int ch=0;ch<node->NumberOfChildren();ch++)
{
INode *cnode= node->GetChildNode(ch);
Interval iv;
Matrix3 tm=cnode->GetObjectTM(t,&iv);
if (cnode->IsGroupMember())
{
reevalGroup = TRUE;
for (int groupCount = 0; groupCount < pblock2->Count(particlemesher_extranodes); groupCount++)
{
INode *extraNode = pblock2->GetINode(particlemesher_extranodes,t,ch);
if (cnode == extraNode)
{
reevalGroup = FALSE;
groupCount = pblock2->Count(particlemesher_extranodes);
}
}
if (reevalGroup)
ch=node->NumberOfChildren();
}
}
if (reevalGroup)
{
tmList.ZeroCount();
pblock2->ZeroCount(particlemesher_extranodes);
for (int ch=0;ch<node->NumberOfChildren();ch++)
{
INode *cnode= node->GetChildNode(ch);
Interval iv;
Matrix3 tm=cnode->GetObjectTM(t,&iv);
if (cnode->IsGroupMember())
{
pblock2->Append(particlemesher_extranodes,1,&cnode);
tmList.Append(1,&tm);
}
}
}
}
if (node)
{
if ( (node->IsGroupHead()) && (pblock2->Count(particlemesher_extranodes)!=0))
{
int ct = 0;
Matrix3 ident(1), inverseTm(1);
mesh.setNumVerts(0);
mesh.setNumFaces(0);
for (int ch=0;ch<pblock2->Count(particlemesher_extranodes);ch++)
{
INode *cnode = pblock2->GetINode(particlemesher_extranodes,t,ch);
if (cnode)
{
Object *pobj = cnode->EvalWorldState(t+offset).obj;
//.........这里部分代码省略.........
示例9: GetCOREInterface
void
ParticleMesherObject::PickPFEvents(HWND hWnd)
{
Tab<INode *> pfEvents;
int numberOfNodes = 1;;
TimeValue t = GetCOREInterface()->GetTime();
pfNodes.ZeroCount();
addPFNodes.ZeroCount();
for (int i = 0; i < numberOfNodes; i++)
{
INode *node;
pblock2->GetValue(particlemesher_pick,t,node,ivalid,i);
if (node)
{
ObjectState tos = node->EvalWorldState(t,TRUE);
if (tos.obj->IsParticleSystem())
{
IParticleObjectExt* epobj;
epobj = (IParticleObjectExt*) tos.obj->GetInterface(PARTICLEOBJECTEXT_INTERFACE);
if (epobj)
{
MyEnumProc dep;
tos.obj->DoEnumDependents(&dep);
for (int i = 0; i < dep.Nodes.Count(); i++)
{
Interval valid;
INode *node = dep.Nodes[i];
Object *obj = node->GetObjectRef();
IParticleGroup* iPGroup = ParticleGroupInterface(obj);
if (iPGroup != nullptr)
{
// we need to filter out the global action list events since
// they do not carry any actual particle shape geometry
if (iPGroup->GetParticleSystem() != iPGroup->GetActionList())
{
pfNodes.Append(1, &node);
}
}
}
}
}
}
}
if (pfNodes.Count() > 0)
{
int iret = DialogBoxParam(hInstance,MAKEINTRESOURCE(IDD_ADD_DIALOG),
hWnd,AddDlgProc,(LPARAM)this);
if ((iret) && (addPFNodes.Count() > 0))
{
theHold.Begin();
for (int i = 0; i < addPFNodes.Count(); i++)
{
int index = addPFNodes[i];
INode *node = pfNodes[index];
pblock2->Append(particlemesher_pfeventlist,1,&node);
}
theHold.Accept(GetString(IDS_ADDEVENTS));
}
}
}
示例10: normal
//.........这里部分代码省略.........
BitArray processedClusters;
processedClusters.SetSize(clusterList.Count());
processedClusters.ClearAll();
Tab<BorderClass> edgesToBeProcessed;
BOOL done = FALSE;
int currentCluster = 0;
processedClusters.Set(0);
clusterList[0]->newX = 0.0f;
clusterList[0]->newY = 0.0f;
// clusterList[0]->angle = 0.0f;
for (int i = 0; i < clusterList[0]->borderData.Count(); i++)
{
int outerFaceIndex = clusterList[0]->borderData[i].outerFace;
int connectedClusterIndex = clusterGroups[outerFaceIndex];
if ((connectedClusterIndex != 0) && (connectedClusterIndex != -1))
{
edgesToBeProcessed.Append(1,&clusterList[0]->borderData[i]);
}
}
BitArray seedFaceList;
seedFaceList.SetSize(clusterGroups.Count());
seedFaceList.ClearAll();
for (i = 0; i < seedFaces.Count(); i++)
{
seedFaceList.Set(seedFaces[i]);
}
while (!done)
{
Tab<int> clustersJustProcessed;
clustersJustProcessed.ZeroCount();
done = TRUE;
int edgeToAlign = -1;
float angDist = PI*2;
if (unfoldMethod == 1)
angDist = PI*2;
else if (unfoldMethod == 2) angDist = 0;
for (i = 0; i < edgesToBeProcessed.Count(); i++)
{
int outerFace = edgesToBeProcessed[i].outerFace;
int connectedClusterIndex = clusterGroups[outerFace];
if (!processedClusters[connectedClusterIndex])
{
int innerFaceIndex = edgesToBeProcessed[i].innerFace;
int outerFaceIndex = edgesToBeProcessed[i].outerFace;
//get angle
Point3 innerNorm, outerNorm;
innerNorm = objNormList[innerFaceIndex];
outerNorm = objNormList[outerFaceIndex];
float dot = DotProd(innerNorm,outerNorm);
float angle = 0.0f;
if (dot == -1.0f)
angle = PI;
else if (dot == 1.0f)
angle = 0.f;
else angle = acos(dot);
if (unfoldMethod == 1)
{
if (seedFaceList[outerFaceIndex])
示例11: PlanarMapNoScale
void UnwrapMod::PlanarMapNoScale(Point3 gNormal)
{
AlignMap();
//add vertices to our internal vertex list filling in dead spots where appropriate
int ct = 0;
//get align normal
//get fit data
PlanarTM.IdentityMatrix();
Interval v;
Point3 identScale(1.0f,1.0f,1.0f);
if (scaleControl) scaleControl->GetValue(0,&gScale,v);
PlanarTM.SetScale(identScale);
if (rotateControl) rotateControl->GetValue(0,&gRotate,v);
PlanarTM.RotateZ(gRotate);
if (offsetControl) offsetControl->GetValue(0,&gOffset,v);
PlanarTM.SetTrans(gOffset);
ComputeSelectedFaceData();
Matrix3 gtm;
UnwrapMatrixFromNormal(gNormal,gtm);
gtm = Inverse(gtm);
DeleteVertsFromFace(gfaces);
//unselect all verts
for (int j=0;j<TVMaps.v.Count();j++)
{
if (vsel[j])
{
vsel.Clear(j);
}
}
//build available list
Tab<int> alist;
alist.ZeroCount();
for (j=0;j<TVMaps.v.Count();j++)
{
if (TVMaps.v[j].flags & FLAG_DEAD)
//dead veretx found copy new vert in and note the place
{
alist.Append(1,&j,1);
}
}
for (int i = 0; i < gverts.d.Count(); i++)
{
BOOL found = FALSE;
if (gverts.sel[i])
{
if (ct < alist.Count() )
{
j = alist[ct];
TVMaps.v[j].flags = 0;
TVMaps.v[j].influence = 0.0f;
Point3 tp = gverts.d[i].p - gCenter;
tp = tp * gtm;
tp.z = 0.0f;
TVMaps.v[j].p = tp;
int vcount = vsel.GetSize();
vsel.Set(j);
if (TVMaps.cont[j]) TVMaps.cont[j]->SetValue(0,&tp,CTRL_ABSOLUTE);
gverts.d[i].newindex = j;
ct++;
}
else
{
UVW_TVVertClass tempv;
Point3 tp = gverts.d[i].p - gCenter;
tp = tp * gtm;
tp.z = 0.0f;
tempv.p = tp;
tempv.flags = 0;
tempv.influence = 0.0f;
gverts.d[i].newindex = TVMaps.v.Count();
TVMaps.v.Append(1,&tempv,1);
vsel.SetSize(TVMaps.v.Count(), 1);
vsel.Set(TVMaps.v.Count()-1);
Control* c;
c = NULL;
TVMaps.cont.Append(1,&c,1);
//.........这里部分代码省略.........
示例12: DoIt
void BakeRadiosity::DoIt(void)
{
DebugPrint(_T("Plug-in Start\n"));
RadiosityInterface *ri;
RadiosityEffect *re;
RadiosityMesh *rm;
INode *node;
Tab<INode *> selNodes;
int nbSel;
// Gets core interface
ri = static_cast<RadiosityInterface*>(
GetCOREInterface(RADIOSITY_INTERFACE));
if(ri == NULL){
DebugPrint(_T("RadiosityInterface error\n"));
return;
}
// Returns a pointer to the currently active Advanced Lighting plug-in.
if((re = ri->GetRadiosity()) == NULL){
DebugPrint(_T("RadiosityEffect error\n"));
return;
}
// Gets Radiosity Mesh
if((rm = GetRadiosityMesh(re)) == NULL){
DebugPrint(_T("RadiosityMesh error\n"));
return;
}
// Resets the container for INode pointers.
selNodes.ZeroCount();
// Returns the number of nodes in the selection set.
nbSel = ip->GetSelNodeCount();
// The loop will continue until handling all seletecd nodes...
for(int i=0; i<nbSel; i++){
// Returns a pointer to the 'i-th' node in the selection set.
if((node = ip->GetSelNode(i)) == NULL){
continue;
}
// Gets the mesh for a node.
Mesh *mesh = NULL;
if(!rm->GetMesh(node, mesh)||(mesh == NULL)){
DebugPrint(_T("GetMesh error\n"));
continue;
}
// Gets the TM for the node.
// TM is the mesh to world space transform.
Matrix3 mtx(1);
if(!rm->GetMeshTM(node, mtx)){
DebugPrint(_T("GetMeshTM error\n"));
continue;
}
// Creates a new mesh
if(!CreateNewMesh(node, mesh, mtx)){
DebugPrint(_T("CreateMesh error\n"));
continue;
}
// Appends a INode pointer to the container
selNodes.Append(1, &node);
}
// Deletes original nodes if the flag is set.
if(keepOrgFlag != true){
nbSel = selNodes.Count();
// The loop will continue until handling all appended nodes...
for(int i=0; i<nbSel; i++){
if(selNodes[i] == NULL){
continue;
}
// Removes it from the hierarchy, and handle undo.
// The position of any children of this node are kept the same.
selNodes[i]->Delete(ip->GetTime(), TRUE);
}
}
DebugPrint(_T("Plug-in End\n"));
}
示例13: fnUnfoldSelectedPolygons
//.........这里部分代码省略.........
}
BitArray processedClusters;
processedClusters.SetSize(clusterList.Count());
processedClusters.ClearAll();
Tab<BorderClass> edgesToBeProcessed;
BOOL done = FALSE;
processedClusters.Set(0);
clusterList[0]->newX = 0.0f;
clusterList[0]->newY = 0.0f;
// clusterList[0]->angle = 0.0f;
for (int i = 0; i < clusterList[0]->borderData.Count(); i++)
{
int outerFaceIndex = clusterList[0]->borderData[i].outerFace;
int connectedClusterIndex = clusterGroups[outerFaceIndex];
if ((connectedClusterIndex != 0) && (connectedClusterIndex != -1))
{
edgesToBeProcessed.Append(1,&clusterList[0]->borderData[i]);
}
}
BitArray seedFaceList;
seedFaceList.SetSize(clusterGroups.Count());
seedFaceList.ClearAll();
for (int i = 0; i < seedFaces.Count(); i++)
{
seedFaceList.Set(seedFaces[i]);
}
while (!done)
{
Tab<int> clustersJustProcessed;
clustersJustProcessed.ZeroCount();
done = TRUE;
int edgeToAlign = -1;
float angDist = PI*2;
if (unfoldMethod == 1)
angDist = PI*2;
else if (unfoldMethod == 2) angDist = 0;
int i;
for (i = 0; i < edgesToBeProcessed.Count(); i++)
{
int outerFace = edgesToBeProcessed[i].outerFace;
int connectedClusterIndex = clusterGroups[outerFace];
if (!processedClusters[connectedClusterIndex])
{
int innerFaceIndex = edgesToBeProcessed[i].innerFace;
int outerFaceIndex = edgesToBeProcessed[i].outerFace;
//get angle
Point3 innerNorm, outerNorm;
innerNorm = objNormList[innerFaceIndex];
outerNorm = objNormList[outerFaceIndex];
float dot = DotProd(innerNorm,outerNorm);
float angle = 0.0f;
if (dot == -1.0f)
angle = PI;
else if (dot >= 1.0f)
angle = 0.f;
else angle = acos(dot);
if (unfoldMethod == 1)
{
示例14: NewLinkDlgProc
INT_PTR CALLBACK NewLinkDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
SlaveControl *slv = DLGetWindowLongPtr<SlaveControl*>(hWnd);
static Tab<int> sid,bid;
switch (msg) {
case WM_INITDIALOG:
{
sid.ZeroCount();
bid.ZeroCount();
slv = (SlaveControl*)lParam;
DLSetWindowLongPtr(hWnd, lParam);
//goto master look at all sub block
int count = slv->master->Blocks.Count();
for (int i = 0; i < count;i++)
{
TSTR blockName = slv->master->SubAnimName(i+1);
for (int j = 0;j < slv->master->Blocks[i]->controls.Count();j++)
{
TSTR subName = slv->master->Blocks[i]->SubAnimName(j);
TSTR finalName = blockName + _T(" ") + subName;
//check if control is the same as ours
if (slv->sub == NULL)
{
if (slv->master->Blocks[i]->controls[j]->SuperClassID() == slv->SuperClassID())
{
//add to list box
sid.Append(1,&j,1);
bid.Append(1,&i,1);
SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_ADDSTRING,0,(LPARAM)(const TCHAR*)finalName);
}
}
else if (slv->master->Blocks[i]->controls[j]->ClassID() == slv->sub->ClassID() )
{
//add to list box
sid.Append(1,&j,1);
bid.Append(1,&i,1);
SendMessage(GetDlgItem(hWnd,IDC_LIST1),
LB_ADDSTRING,0,(LPARAM)(const TCHAR*)finalName);
}
}
}
SendMessage(GetDlgItem(hWnd,IDC_LIST1), LB_SETCURSEL,0,0);
CenterWindow(hWnd,GetParent(hWnd));
break;
}
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
{
int sel = SendMessage(GetDlgItem(hWnd,IDC_LIST1),
LB_GETCURSEL,0,0);
if (sel >=0)
{
slv->propBlockID = bid[sel];
slv->propSubID = sid[sel];
slv->NotifyDependents(FOREVER, (PartID)PART_ALL, REFMSG_CHANGE);
}
EndDialog(hWnd,1);
break;
}
case IDCANCEL:
EndDialog(hWnd,0);
break;
}
break;
default:
return FALSE;
}
return TRUE;
}