本文整理汇总了C++中BitArray::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BitArray::GetSize方法的具体用法?C++ BitArray::GetSize怎么用?C++ BitArray::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitArray
的用法示例。
在下文中一共展示了BitArray::GetSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void UnwrapMod::BuildUsedList(BitArray &usedVerts, ClusterClass *cluster)
{
usedVerts.SetSize(TVMaps.v.Count());
usedVerts.ClearAll();
for (int j =0; j < cluster->faces.Count(); j++)
{
int faceIndex = cluster->faces[j];
for (int k = 0; k < TVMaps.f[faceIndex]->count; k++)
{
//need to put patch handles in here also
int index = TVMaps.f[faceIndex]->t[k];
usedVerts.Set(index);
if ((TVMaps.f[faceIndex]->flags & FLAG_CURVEDMAPPING) && (TVMaps.f[faceIndex]->vecs))
{
index = TVMaps.f[faceIndex]->vecs->handles[k*2];
if ((index >= 0) && (index < usedVerts.GetSize()))
usedVerts.Set(index);
index = TVMaps.f[faceIndex]->vecs->handles[k*2+1];
if ((index >= 0) && (index < usedVerts.GetSize()))
usedVerts.Set(index);
if (TVMaps.f[faceIndex]->flags & FLAG_INTERIOR)
{
index = TVMaps.f[faceIndex]->vecs->interiors[k];
if ((index >= 0) && (index < usedVerts.GetSize()))
usedVerts.Set(index);
}
}
}
}
}
示例2: ApplyChanges
void EditFaceDataModData::ApplyChanges (MNMesh & mesh) {
// Make sure we're sized correctly for this mesh.
// (NOTE: If the user reduces, then increases input number of faces, we lose data.)
if (mesh.numf != mFaceSel.GetSize()) SynchSize (mesh.numf);
// Set the selection:
mesh.FaceSelect (mFaceSel);
// Get the face data manager from the mesh:
DebugPrint ("EditFaceDataMod: Getting manager from MNMesh (0x%08x)\n", &mesh);
IFaceDataMgr *pFDMgr = static_cast<IFaceDataMgr*>(mesh.GetInterface (FACEDATAMGR_INTERFACE));
if (pFDMgr == NULL) return;
SampleFaceData* fdc = dynamic_cast<SampleFaceData*>(pFDMgr->GetFaceDataChan( FACE_MAXSAMPLEUSE_CLSID ));
if ( fdc == NULL ) {
// The mesh does not have our sample face-data channel so we will add it here
fdc = new SampleFaceData();
fdc->FacesCreated (0, mFaceSel.GetSize());
pFDMgr->AddFaceDataChan( fdc );
}
if (!mFacesAffected.NumberSet ()) return;
for (int i=0; i<mFacesAffected.GetSize(); i++) {
if (!mFacesAffected[i]) continue;
fdc->SetValue (i, mtNewFaceValues[i]);
}
}
示例3: AssignSetMatchSize
static void AssignSetMatchSize(BitArray &dst, BitArray &src)
{
int size = dst.GetSize();
dst = src;
if (dst.GetSize() != size)
{
dst.SetSize(size, TRUE);
}
}
示例4: SetFaceValue
void EditFaceDataModData::SetFaceValue (BitArray & faces, float val) {
for (int i=0; i<faces.GetSize(); i++) {
if (!faces[i]) continue;
mFacesAffected.Set (i);
mtNewFaceValues[i] = val;
}
}
示例5: Delete
int ParticleChannelInt::Delete(BitArray& toRemove)
{
int checkCount = min(toRemove.GetSize(), Count());
if (isGlobal())
{
// find number of set bit in the "count" range
int numRemove = 0;
for(int i=0; i<checkCount; i++)
if (toRemove[i] != 0) numRemove++;
_globalCount() -= numRemove;
return globalCount();
}
else
{
int i, j;
for (i = j = 0; i < data().Count(); i++) {
if (i < checkCount && toRemove[i] != 0)
continue;
if (i != j) _data(j) = data(i);
j++;
}
if (j < data().Count())
_data().SetCount(j);
return data().Count();
}
}
示例6: MarkDeadVertices
void UVW_ChannelClass::MarkDeadVertices()
{
BitArray usedVerts;
usedVerts.SetSize(v.Count());
usedVerts.ClearAll();
for (int i =0; i < f.Count(); i++)
{
if (!(f[i]->flags & FLAG_DEAD))
{
for (int j=0; j < f[i]->count; j++)
{
int id = f[i]->t[j];
if (id < usedVerts.GetSize()) usedVerts.Set(id);
if ((f[i]->flags & FLAG_CURVEDMAPPING) && (f[i]->vecs))
{
id = f[i]->vecs->handles[j*2];
if (id < usedVerts.GetSize()) usedVerts.Set(id);
id = f[i]->vecs->handles[j*2+1];
if (id < usedVerts.GetSize()) usedVerts.Set(id);
if (f[i]->flags & FLAG_INTERIOR)
{
id = f[i]->vecs->interiors[j];
if (id < usedVerts.GetSize()) usedVerts.Set(id);
}
}
}
}
}
for (int i =0; i < v.Count(); i++)
{
if (i < usedVerts.GetSize())
{
BOOL isRigPoint = v[i].GetFlag() & FLAG_RIGPOINT;
if (!usedVerts[i] && (!isRigPoint))
{
v[i].SetDead();
}
}
}
}
示例7:
void UnwrapMod::fnPasteInstance()
{
//make sure mods are the same
theHold.Begin();
HoldPointsAndFaces();
for (int ldID = 0; ldID < mMeshTopoData.Count(); ldID++)
{
MeshTopoData *ld = mMeshTopoData[ldID];
if ((this == copyPasteBuffer.mod) && (ld == copyPasteBuffer.lmd))
{
BitArray faceSel = ld->GetFaceSelection();
//loop through selected faces
int copyIndex = 0;
for (int i =0; i < faceSel.GetSize(); i++)
{
if (faceSel[i])
{
//make sure selected faces count = buffer face
if (( i < ld->GetNumberFaces()/*TVMaps.f.Count()*/) && (copyIndex < copyPasteBuffer.faceData.Count()))
{
int degree = ld->GetFaceDegree(i);
if (degree == copyPasteBuffer.faceData[copyIndex]->count)
{
//if so set the face data indices as the same
for (int j = 0; j < degree; j++)
{
//index into the texture vertlist
ld->SetFaceTVVert(i,j,copyPasteBuffer.faceData[copyIndex]->t[j]);//TVMaps.f[i]->t[j] = copyPasteBuffer.faceData[copyIndex]->t[j];
//index into the geometric vertlist
if ((ld->GetFaceHasVectors(i)/*TVMaps.f[i]->vecs*/) && (j < 4))
{
ld->SetFaceTVInterior(i,j,copyPasteBuffer.faceData[copyIndex]->vecs->interiors[j]);//TVMaps.f[i]->vecs->interiors[j] = copyPasteBuffer.faceData[copyIndex]->vecs->interiors[j];
ld->SetFaceTVHandle(i,j*2,copyPasteBuffer.faceData[copyIndex]->vecs->handles[j*2]);//TVMaps.f[i]->vecs->handles[j*2] = copyPasteBuffer.faceData[copyIndex]->vecs->handles[j*2];
ld->SetFaceTVHandle(i,j*2+1,copyPasteBuffer.faceData[copyIndex]->vecs->handles[j*2+1]);//TVMaps.f[i]->vecs->handles[j*2+1] = copyPasteBuffer.faceData[copyIndex]->vecs->handles[j*2+1];
}
}
copyIndex++;
}
}
}
}
ld->SetTVEdgeInvalid();
}
}
CleanUpDeadVertices();
theHold.Accept(GetString(IDS_PW_PASTE));
NotifyDependents(FOREVER,PART_ALL,REFMSG_CHANGE);
InvalidateView();
GetCOREInterface()->RedrawViews(GetCOREInterface()->GetTime());
}
示例8: Restore
void EditFaceDataRestore::Restore(int isUndo) {
if (firstFace < 0) return;
if (isUndo && !after_called) After();
for (int i=firstFace; i<faces.GetSize(); i++) {
if (!faces[i]) continue;
if (!set_before[i]) modData->ResetFace (i);
else modData->SetFaceValue (i, before[i]);
}
mod->ValueChanged ();
}
示例9: Split
IObject* ParticleChannelMap::Split(BitArray& toSplit)
{
// SysUtil::NeedToImplementLater(); // TODO: optimize the implementation
ParticleChannelMap* newChannel = (ParticleChannelMap*)Clone();
Delete(toSplit);
BitArray reverse = ~toSplit;
if (reverse.GetSize() != newChannel->Count())
reverse.SetSize(newChannel->Count(), TRUE);
newChannel->Delete(reverse);
return newChannel;
}
示例10: DescribeSelection
void EditFaceDataModData::DescribeSelection (int & numFaces, int & whichFace, float & value, bool &valueDetermined) {
numFaces = 0;
for (int i=0; i<mFaceSel.GetSize(); i++) {
if (!mFaceSel[i]) continue;
if (!numFaces) {
whichFace = i;
value = FaceValue (i);
} else if (valueDetermined) {
if (value != FaceValue(i)) valueDetermined = false;
}
numFaces++;
}
}
示例11: SelectByMaterial
void EditPolyData::SelectByMaterial (EditPolyMod *pMod) {
if (pMod->GetMNSelLevel() != MNM_SL_FACE) return;
if (!mpMesh) return;
int clear = pMod->getParamBlock()->GetInt (epm_material_selby_clear);
int matInt = pMod->getParamBlock()->GetInt (epm_material_selby);
MtlID matID = (MtlID) matInt;
SetupNewSelection (MNM_SL_FACE);
BitArray *pSel = GetNewSelection ();
for (int i=0; i<pSel->GetSize(); i++)
{
if (mpMesh->f[i].material == matID) pSel->Set(i);
}
ApplyNewSelection (pMod, !clear);
}
示例12: SelectBySmoothingGroup
void EditPolyData::SelectBySmoothingGroup (EditPolyMod *pMod) {
if (pMod->GetMNSelLevel() != MNM_SL_FACE) return;
if (!mpMesh) return;
int clear = pMod->getParamBlock()->GetInt (epm_smoother_selby_clear);
int smgInt = pMod->getParamBlock()->GetInt (epm_smoother_selby);
DWORD *smg = (DWORD *) ((void *)&smgInt);
SetupNewSelection (MNM_SL_FACE);
BitArray *pSel = GetNewSelection ();
for (int i=0; i<pSel->GetSize(); i++)
{
if (mpMesh->f[i].smGroup & (*smg)) pSel->Set(i);
}
ApplyNewSelection (pMod, !clear);
}
示例13: TranslateNewSelection
void EditPolyData::TranslateNewSelection (int selLevelFrom, int selLevelTo) {
if (!mpNewSelection) return;
if (!mpMesh) {
DbgAssert (0);
return;
}
BitArray intermediateSelection;
BitArray toSelection;
switch (selLevelFrom) {
case EPM_SL_VERTEX:
switch (selLevelTo) {
case EPM_SL_EDGE:
mSelConv.VertexToEdge (*mpMesh, *mpNewSelection, toSelection);
break;
case EPM_SL_BORDER:
mSelConv.VertexToEdge (*mpMesh, *mpNewSelection, intermediateSelection);
mSelConv.EdgeToBorder (*mpMesh, intermediateSelection, toSelection);
break;
case EPM_SL_FACE:
mSelConv.VertexToFace (*mpMesh, *mpNewSelection, toSelection);
break;
case EPM_SL_ELEMENT:
mSelConv.VertexToFace (*mpMesh, *mpNewSelection, intermediateSelection);
mSelConv.FaceToElement (*mpMesh, intermediateSelection, toSelection);
break;
}
break;
case EPM_SL_EDGE:
if (selLevelTo == EPM_SL_BORDER) {
mSelConv.EdgeToBorder (*mpMesh, *mpNewSelection, toSelection);
}
break;
case EPM_SL_FACE:
if (selLevelTo == EPM_SL_ELEMENT) {
mSelConv.FaceToElement (*mpMesh, *mpNewSelection, toSelection);
}
break;
}
if (toSelection.GetSize() == 0) return;
*mpNewSelection = toSelection;
}
示例14: FaceValue
float EditFaceDataModData::FaceValue (int faceID) {
if (faceID<0) return 0.0f;
if (faceID>mFacesAffected.GetSize()) return 0.0f;
if (mFacesAffected[faceID]) return mtNewFaceValues[faceID];
IFaceDataMgr *pFDMgr = NULL;
if (mpCacheMesh && (faceID < mpCacheMesh->numFaces)) {
// Get the face data manager from the mesh:
pFDMgr = static_cast<IFaceDataMgr*>(mpCacheMesh->GetInterface (FACEDATAMGR_INTERFACE));
}
if (mpCacheMNMesh && (faceID < mpCacheMNMesh->numf)) {
// Get the face data manager from the mesh:
pFDMgr = static_cast<IFaceDataMgr*>(mpCacheMNMesh->GetInterface (FACEDATAMGR_INTERFACE));
}
if (pFDMgr == NULL) return 0.0f;
SampleFaceData* fdc = dynamic_cast<SampleFaceData*>(pFDMgr->GetFaceDataChan( FACE_MAXSAMPLEUSE_CLSID ));
if (!fdc) return 0.0f;
float val;
if (!fdc->GetValue (faceID, val)) return 0.0f;
return val;
}
示例15: BuildInitialMapping
void UnwrapMod::BuildInitialMapping(Mesh *msh)
{
//build bounding box
Box3 bbox;
bbox.Init();
//normalize the length width height
for (int i = 0; i < TVMaps.f.Count(); i++)
{
int pcount = 3;
// if (TVMaps.f[i].flags & FLAG_QUAD)
pcount = TVMaps.f[i]->count;
for (int j = 0; j < pcount; j++)
{
bbox += TVMaps.geomPoints[TVMaps.f[i]->v[j]];
}
}
Tab<int> indexList;
indexList.SetCount(TVMaps.f.Count() *4);
BitArray usedIndex;
usedIndex.SetSize(TVMaps.f.Count() *4);
usedIndex.ClearAll();
for (i = 0; i < TVMaps.f.Count()*4; i++)
indexList[i] = -1;
for (i = 0; i < TVMaps.f.Count(); i++)
{
if (!(TVMaps.f[i]->flags & FLAG_DEAD))
{
int pcount = 3;
// if (TVMaps.f[i].flags & FLAG_QUAD) pcount = 4;
pcount = TVMaps.f[i]->count;
for (int j = 0; j < pcount; j++)
{
usedIndex.Set(msh->faces[i].v[j]);
}
}
}
int ct = 0;
for (i = 0; i < usedIndex.GetSize(); i++)
{
if (usedIndex[i])
indexList[i] = ct++;
}
TVMaps.v.SetCount(usedIndex.NumberSet());
TVMaps.cont.SetCount(usedIndex.NumberSet());
vsel.SetSize(usedIndex.NumberSet());
//watje 10-19-99 bug 213437 to prevent a divide by 0 which gives you a huge u,v, or w value
if (bbox.Width().x == 0.0f) bbox += Point3(0.5f,0.0f,0.0f);
if (bbox.Width().y == 0.0f) bbox += Point3(0.0f,0.5f,0.0f);
if (bbox.Width().z == 0.0f) bbox += Point3(0.0f,0.0f,0.5f);
for (i = 0; i < TVMaps.f.Count(); i++)
{
if (!(TVMaps.f[i]->flags & FLAG_DEAD))
{
int pcount = 3;
// if (TVMaps.f[i].flags & FLAG_QUAD) pcount = 4;
pcount = TVMaps.f[i]->count;
TVMaps.f[i]->flags &= ~FLAG_DEAD;
for (int j = 0; j < pcount; j++)
{
int index;
int a = msh->faces[i].v[j];
index = indexList[a];
TVMaps.f[i]->t[j] = index;
TVMaps.v[index].p.x = TVMaps.geomPoints[TVMaps.f[i]->v[j]].x/bbox.Width().x + 0.5f;
TVMaps.v[index].p.y = TVMaps.geomPoints[TVMaps.f[i]->v[j]].y/bbox.Width().y + 0.5f;
TVMaps.v[index].p.z = TVMaps.geomPoints[TVMaps.f[i]->v[j]].z/bbox.Width().z + 0.5f;
TVMaps.v[index].influence = 0.f;
TVMaps.v[index].flags = 0.f;
TVMaps.cont[index] = NULL;
}
}
}
}