本文整理汇总了C++中Tab::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ Tab::Count方法的具体用法?C++ Tab::Count怎么用?C++ Tab::Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tab
的用法示例。
在下文中一共展示了Tab::Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Validate
BOOL PFOperatorInstanceShapeMXSValidator::Validate(PB2Value& v)
{
INode* iNode = (INode*)v.r;
if (iNode == NULL) return NULL;
TimeValue t = GetCOREInterface()->GetTime();
Tab<INode*> stack;
stack.Append(1, &iNode, 10);
while (stack.Count())
{
INode *node = stack[stack.Count()-1];
stack.Delete(stack.Count()-1, 1);
Object *obj = node->EvalWorldState(t).obj;
if (obj->CanConvertToType(Class_ID(TRIOBJ_CLASS_ID, 0)))
return TRUE;
// add children to the stack
for (int i = 0; i < node->NumberOfChildren(); i++) {
INode *childNode = node->GetChildNode(i);
if (childNode) stack.Append(1, &childNode, 10);
}
}
return FALSE;
}
示例2: ProjectPoint
bool SplineData::ProjectPoint(int splineIndex, Point3 p, Point3 &hitUVW, float &d, Point3 &hitPoint, SplineMapProjectionTypes projectionType, bool onlyInsideEnvelope, int maxIterations)
{
bool hit = false;
float scale = 1.0f; //scale is used to expand our envelopes on each pass so we find at least a close point
float limit = 128.0f;
if (onlyInsideEnvelope)
limit = 2.0f;
mSplineElementData[splineIndex]->mClosestSubs.SetSize(mSplineElementData[splineIndex]->GetNumberOfSubBoundingBoxes());
mSplineElementData[splineIndex]->mClosestSubs.ClearAll();
while (!hit && scale < limit)
{
Tab<int> bounds;
//start by getting a list of samples that contain this point
mSplineElementData[splineIndex]->Contains(p,bounds,scale);
if (bounds.Count())
{
Point3 uvw = Point3(0.0f,0.0f,0.0f);
float closestD = -1.0f;
int closestSeg = 0;
for (int j = 0; j < bounds.Count(); j++)
{
//get our sample index
int index = bounds[j];
Point3 testUVW(0.0f,0.0f,0.0f);
float testD = 0.0f;
//find the closest sample
if (mSplineElementData[splineIndex]->ProjectPoint(p, index, testUVW, testD, hitPoint,projectionType,scale,maxIterations))
{
if ((testD < closestD) || (closestD == -1.0f))
{
hitUVW = testUVW;
closestD = testD;
d = testD;
hit = true;
closestSeg = j;
mSplineElementData[splineIndex]->mClosestSubs.Set(closestSeg,TRUE);
}
else
{
}
}
}
}
//increase our scale in case we did not find a hit
scale *= 2.0f;
}
return hit;
}
示例3: MAXException
void Unreal3DExport::WriteModel()
{
// Progress
pInt->ProgressUpdate(Progress, FALSE, GetString(IDS_INFO_WRITE));
// Open data file
fMesh = _tfopen(ModelFileName,_T("wb"));
if( !fMesh )
{
ProgressMsg.printf(GetString(IDS_ERR_FMODEL),ModelFileName);
throw MAXException(ProgressMsg.data());
}
// Open anim file
fAnim = _tfopen(AnimFileName,_T("wb"));
if( !fAnim )
{
ProgressMsg.printf(GetString(IDS_ERR_FANIM),AnimFileName);
throw MAXException(ProgressMsg.data());
}
// data headers
hData.NumPolys = Tris.Count();
hData.NumVertices = VertsPerFrame;
// anim headers
hAnim.FrameSize = VertsPerFrame * sizeof(FMeshVert);
hAnim.NumFrames = FrameCount;
// Progress
CheckCancel();
pInt->ProgressUpdate(Progress, FALSE, GetString(IDS_INFO_WMESH));
// Write data
fwrite(&hData,sizeof(FJSDataHeader),1,fMesh);
if( Tris.Count() > 0 )
{
fwrite(Tris.Addr(0),sizeof(FJSMeshTri),Tris.Count(),fMesh);
}
Progress += U3D_PROGRESS_WMESH;
// Progress
CheckCancel();
pInt->ProgressUpdate(Progress, FALSE, GetString(IDS_INFO_WANIM));
// Write anim
fwrite(&hAnim,sizeof(FJSAnivHeader),1,fAnim);
if( Verts.Count() > 0 )
{
fwrite(Verts.Addr(0),sizeof(FMeshVert),Verts.Count(),fAnim);
}
Progress += U3D_PROGRESS_WANIM;
}
示例4: if
void Unreal3DExport::Prepare()
{
// Optimize
if( bMaxResolution && Points.Count() > 1 )
{
pInt->ProgressUpdate(Progress, FALSE, GetString(IDS_INFO_OPT_SCAN));
Point3 MaxPoint = Points[0];
Point3 MinPoint = MaxPoint;
// get scene bounding box
for( int i=1; i<Points.Count(); ++i )
{
if ( Points[i].x > MaxPoint.x ) MaxPoint.x = Points[i].x;
else if ( Points[i].x < MinPoint.x ) MinPoint.x = Points[i].x;
if ( Points[i].y > MaxPoint.y ) MaxPoint.y = Points[i].y;
else if ( Points[i].y < MinPoint.y ) MinPoint.y = Points[i].y;
if ( Points[i].z > MaxPoint.z ) MaxPoint.z = Points[i].z;
else if ( Points[i].z < MinPoint.z ) MinPoint.z = Points[i].z;
}
// get center point
OptOffset = MaxPoint+MinPoint;
OptOffset *= 0.5;
// center bounding box
MaxPoint -= OptOffset;
MinPoint -= OptOffset;
// See FMeshVert
OptScale.x = 1023.0f / max(fabs(MaxPoint.x),fabs(MinPoint.x));
OptScale.y = 1023.0f / max(fabs(MaxPoint.y),fabs(MinPoint.y));
OptScale.z = 511.0f / max(fabs(MaxPoint.z),fabs(MinPoint.z));
// apply adjustments
pInt->ProgressUpdate(Progress, FALSE, GetString(IDS_INFO_OPT_APPLY));
for( int i=0; i<Points.Count(); ++i )
{
Point3& p = Points[i];
p -= OptOffset;
p *= OptScale;
}
}
// Convert verts
Verts.SetCount(Points.Count(),TRUE);
for( int i=0; i<Points.Count(); ++i )
{
Verts[i] = FMeshVert(Points[i]);
}
}
示例5: SetSubTexmap
void Composite::SetSubTexmap(int i, Texmap *m) {
if (i>=subTex.Count()) {
int n = subTex.Count();
subTex.SetCount(i+1);
pblock->SetCount(comptex_tex,i+1);
for (int j=n; j<=i; j++)
subTex[j] = NULL;
}
ReplaceReference(i+1,m);
ivalid.SetEmpty();
if (paramDlg)
paramDlg->UpdateSubTexNames();
}
示例6: Update
void Composite::Update(TimeValue t, Interval& valid)
{
if (!ivalid.InInterval(t)) {
ivalid.SetInfinite();
int n = pblock->Count(comptex_ons);
if (n!=mapOn.Count()) mapOn.SetCount(n);
for (int i=0; i<subTex.Count(); i++) {
pblock->GetValue(comptex_ons,0,mapOn[i],valid,i);
if (subTex[i])
subTex[i]->Update(t,ivalid);
}
}
valid &= ivalid;
}
示例7: Do
void PolyOpChamferEdge::Do (MNMesh & mesh)
{
MNChamferData *pMeshChamData = new MNChamferData;
mesh.ChamferEdges (MN_USER, pMeshChamData);
Tab<UVVert> mapDelta;
for (int mapChannel = -NUM_HIDDENMAPS; mapChannel<mesh.numm; mapChannel++) {
if (mesh.M(mapChannel)->GetFlag (MN_DEAD)) continue;
pMeshChamData->GetMapDelta (mesh, mapChannel, mAmount, mapDelta);
for (int i=0; i<mapDelta.Count(); i++) mesh.M(mapChannel)->v[i] += mapDelta[i];
}
Tab<Point3> vertexDelta;
pMeshChamData->GetDelta (mAmount, vertexDelta);
for (int i=0; i<vertexDelta.Count(); i++) mesh.P(i) += vertexDelta[i];
}
示例8: RebuildPaintNodes
void BonesDefMod::RebuildPaintNodes()
{
//this sends all our dependant nodes to the painter
MyEnumProc dep;
EnumDependents(&dep);
Tab<INode *> nodes;
for (int i = 0; i < nodes.Count(); i++)
{
ObjectState os = nodes[i]->EvalWorldState(GetCOREInterface()->GetTime());
if ( (os.obj->NumPoints() != painterData[i].bmd->VertexData.Count()) ||
(painterData[i].bmd->isPatch) || (painterData[i].bmd->inputObjectIsNURBS) )
{
int ct = painterData[i].bmd->VertexData.Count();
Tab<Point3> pointList;
pointList.SetCount(ct);
Matrix3 tm = nodes[i]->GetObjectTM(GetCOREInterface()->GetTime());
for (int j =0; j < ct; j++)
{
pointList[j] = painterData[i].bmd->VertexData[j]->LocalPosPostDeform*tm;
}
pPainterInterface->LoadCustomPointGather(ct, pointList.Addr(0), nodes[i]);
}
}
pPainterInterface->UpdateMeshes(TRUE);
}
示例9: IProjectVertex
BOOL plDistributor::IProjectVertex(const Point3& pt, const Point3& dir, float maxDist, Tab<int32_t>&faces, Point3& projPt) const
{
BOOL retVal = false;
plTriUtils triUtil;
int i;
for( i = 0; i < faces.Count(); i++ )
{
int iFace = faces[i];
const hsPoint3& p0 = hsP3(fSurfMesh->getVert(fSurfMesh->faces[iFace].getVert(0)) * fSurfToWorld);
const hsPoint3& p1 = hsP3(fSurfMesh->getVert(fSurfMesh->faces[iFace].getVert(1)) * fSurfToWorld);
const hsPoint3& p2 = hsP3(fSurfMesh->getVert(fSurfMesh->faces[iFace].getVert(2)) * fSurfToWorld);
Point3 plnPt = pt;
if( triUtil.ProjectOntoPlaneAlongVector(p0, p1, p2, hsV3(dir), hsP3(plnPt)) )
{
Point3 bary = plnPt;
plTriUtils::Bary baryVal = triUtil.ComputeBarycentric(p0, p1, p2, hsP3(plnPt), hsP3(bary));
if( (plTriUtils::kOutsideTri != baryVal) && (plTriUtils::kDegenerateTri != baryVal) )
{
float dist = DotProd((pt - plnPt), dir);
if( (dist <= maxDist) && (dist >= -maxDist) )
{
projPt = plnPt;
maxDist = dist >= 0 ? dist : -dist;
retVal = true;
}
}
}
}
return retVal;
}
示例10: SetInitialBoneStates
void SpringSys::SetInitialBoneStates(Tab<Matrix3> boneTMs)
{
for (int x = 0; x< GetParticles()->length(); x++)
{
SSParticle *p = GetParticle(x);
for (int tmId = 0; tmId< boneTMs.Count(); tmId++)
{
for (int i=0;i<p->GetSprings()->length();i++)
{
if (tmId == p->GetSpring(i)->GetPointConstraint()->GetIndex())
{
if (tmId == 0)
p->GetSpring(i)->SetLength(Point3::Origin);
else p->GetSpring(i)->SetLength( initPosTab[x] * Inverse(boneTMs[tmId]) );
p->GetSpring(i)->GetPointConstraint()->SetPos(initPosTab[x]);
p->GetSpring(i)->GetPointConstraint()->SetVel(Point3::Origin);
}
}
if (frameCache.bone.length() <= tmId)
{
SSConstraintPoint contBone = SSConstraintPoint(tmId);
frameCache.bone.append(contBone);
}
}
//frameCache.bone.SetCount(tmId+1);
}
}
示例11: Save
IOResult Composite::Save(ISave *isave) {
IOResult res;
ULONG nb;
// Save common stuff
isave->BeginChunk(MTL_HDR_CHUNK);
res = MtlBase::Save(isave);
if (res!=IO_OK) return res;
isave->EndChunk();
int c = subTex.Count();
isave->BeginChunk(SUBTEX_COUNT_CHUNK);
isave->Write(&c,sizeof(c),&nb);
isave->EndChunk();
isave->BeginChunk(PARAM2_CHUNK);
isave->EndChunk();
/* for (int i=0; i<subTex.Count(); i++) {
if (mapOn[i]==0) {
isave->BeginChunk(MAPOFF_CHUNK+i);
isave->EndChunk();
}
}
*/
return IO_OK;
}
示例12: ReInit
void Water::ReInit() {
float c[3], d;
if (count!=waves.Count()) {
waves.SetCount(count);
waves.Resize(count);
}
// Reseed random number generator
srand(randSeed);
// Compute wave centers on sphere with radius size
for (int i = 0; i < count; i++) {
WaveDesc &wv = waves[i];
c[0] = frand();
c[1] = (type == 0) ? frand() : 0.0f;
c[2] = frand();
d = size/(float)sqrt(c[0]*c[0]+c[1]*c[1]+c[2]*c[2]);
wv.cent[0] = c[0]*d;
wv.cent[1] = c[1]*d;
wv.cent[2] = c[2]*d;
wv.period = (((float)(rand()&0x7FFF))/32768.0f)*
(maxperiod-minperiod)+minperiod;
wv.rate = (float)sqrt(maxperiod/wv.period);
}
}
示例13: GetCrossSection
void SplineData::RotateSelectedCrossSections(Quat q)
{
Tab<int> selSplines;
Tab<int> selCrossSections;
GetSelectedCrossSections(selSplines,selCrossSections);
//move the cross sections
for (int i = 0; i < selSplines.Count(); i++)
{
int splineIndex = selSplines[i];
int crossSectionIndex = selCrossSections[i];
SplineCrossSection *section = GetCrossSection(splineIndex,crossSectionIndex);
Matrix3 sTM = section->mTM;
sTM.NoScale();
sTM.NoTrans();
Quat tq = TransformQuat(sTM,q);
//no back into our initial space
tq = TransformQuat(section->mIBaseTM,tq);
section->mQuat += tq;
}
RecomputeCrossSections();
}
示例14: HitTestCrossSection
BOOL SplineData::HitTestCrossSection(GraphicsWindow *gw, HitRegion hr, SplineMapProjectionTypes projType, Tab<int> &hitSplines, Tab<int> &hitCrossSections)
{
hitSplines.SetCount(0);
hitCrossSections.SetCount(0);
DWORD limit = gw->getRndLimits();
gw->setRndLimits(( limit | GW_PICK) & ~GW_ILLUM);
gw->setHitRegion(&hr);
//loop through splines
for (int splineIndex = 0; splineIndex < mSplineElementData.Count();splineIndex++)
{
if (mSplineElementData[splineIndex]->IsSelected())
{
for (int crossSectionIndex = 0; crossSectionIndex < NumberOfCrossSections(splineIndex); crossSectionIndex++)
{
SplineCrossSection section = mSplineElementData[splineIndex]->GetCrossSection(crossSectionIndex);
Matrix3 crossSectionTM = section.mTM;
gw->setTransform(crossSectionTM);
gw->clearHitCode();
mSplineElementData[splineIndex]->DisplayCrossSections(gw, crossSectionIndex,projType );
if (gw->checkHitCode())
{
hitSplines.Append(1,&splineIndex,10);
hitCrossSections.Append(1,&crossSectionIndex,10);
}
}
}
}
return hitSplines.Count();
}
示例15: Spawn
bool ParticleChannelInt::Spawn(Tab<int>& spawnTable)
{
SysUtil::NeedToImplementLater(); // optimize the implementation
int i, checkCount = min(spawnTable.Count(), Count());
if (isGlobal())
{
int newCount = 0;
for(i=0; i<checkCount; i++)
if (spawnTable[i] > 0) newCount += spawnTable[i];
_globalCount() = newCount;
}
else
{
Tab<int> oldData(data());
int j, k, newCount = 0;
for(i=0; i<checkCount; i++)
if (spawnTable[i] > 0) newCount += spawnTable[i];
_data().SetCount(newCount);
for(i=0, j=0; i<checkCount; i++)
for(k=0; k<spawnTable[i]; k++)
_data(j++) = oldData[i];
}
return true;
}