当前位置: 首页>>代码示例>>C++>>正文


C++ hsTArray类代码示例

本文整理汇总了C++中hsTArray的典型用法代码示例。如果您正苦于以下问题:C++ hsTArray类的具体用法?C++ hsTArray怎么用?C++ hsTArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了hsTArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: IRenormalize

void plMorphSequence::IRenormalize(hsTArray<plAccessSpan>& dst) const
{
    int i;
    for( i = 0; i < dst.GetCount(); i++ )
    {
        hsAssert(dst[i].HasAccessVtx(), "Come on, everyone has vertices");
        plAccessVtxSpan& accVtx = dst[i].AccessVtx();
        int j;
        for( j = 0; j < accVtx.VertCount(); j++ )
        {
            hsFastMath::Normalize(accVtx.Normal(j));
        }
    }
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:14,代码来源:plMorphSequence.cpp

示例2: setPosDeltas

void plSpanInstance::setPosDeltas(const hsTArray<hsVector3>& verts) {
    delete[] fPosDelta;
    fNumVerts = verts.getSize();
    fPosDelta = new unsigned char[fNumVerts * CalcPosStride(fEncoding)];

    switch (fEncoding.getCode() & plSpanEncoding::kPosMask) {
    case plSpanEncoding::kPos888:
        {
            unsigned char* pp = fPosDelta;
            for (unsigned int i=0; i<fNumVerts; i++) {
                pp[0] = (unsigned char)(verts[i].X / fEncoding.getPosScale());
                pp[1] = (unsigned char)(verts[i].Y / fEncoding.getPosScale());
                pp[2] = (unsigned char)(verts[i].Z / fEncoding.getPosScale());
                pp += 3;
            }
        }
        break;
    case plSpanEncoding::kPos161616:
        {
            unsigned short* pp = (unsigned short*)fPosDelta;
            for (unsigned int i=0; i<fNumVerts; i++) {
                pp[0] = (unsigned short)(verts[i].X / fEncoding.getPosScale());
                pp[1] = (unsigned short)(verts[i].X / fEncoding.getPosScale());
                pp[2] = (unsigned short)(verts[i].X / fEncoding.getPosScale());
                pp += 3;
            }
        }
        break;
    case plSpanEncoding::kPos101010:
        {
            unsigned int* pp = (unsigned int*)fPosDelta;
            for (unsigned int i=0; i<fNumVerts; i++) {
                *pp = ((unsigned int)(verts[i].Z / fEncoding.getPosScale()) & 0x3F) << 20
                    | ((unsigned int)(verts[i].Y / fEncoding.getPosScale()) & 0x3F) << 10
                    | ((unsigned int)(verts[i].X / fEncoding.getPosScale()) & 0x3F);
                pp++;
            }
        }
        break;
    case plSpanEncoding::kPos008:
        {
            unsigned char* pp = fPosDelta;
            for (unsigned int i=0; i<fNumVerts; i++) {
                *pp = (unsigned char)(verts[i].Z / fEncoding.getPosScale());
                pp++;
            }
        }
        break;
    }
}
开发者ID:boq,项目名称:libhsplasma,代码行数:50,代码来源:plSpanInstance.cpp

示例3: IFindAllBindingsByKey

// Find ALL bindings that could be triggered by this combo. Meaning that if we have multiple
// bindings for a key with different shift/ctrl combinations, we want any that are satisfied with
// the given combo.
// We guarantee that the first binding in the result array is that one with priority.
void plKeyMap::IFindAllBindingsByKey(const plKeyCombo &combo, hsTArray<plKeyBinding*> &result) const
{
    uint32_t i;
    uint8_t bestScore = 0;
    for (i = 0; i < fBindings.GetCount(); i++)
    {
        hsBool s1, s2;
        s1 = fBindings[i]->GetKey1().IsSatisfiedBy(combo);
        s2 = fBindings[i]->GetKey2().IsSatisfiedBy(combo);
        if (s1 || s2)
        {
            uint8_t myScore = 0;
            if (s1)
                myScore = fBindings[i]->GetKey1().fFlags;
            if (s2 && (fBindings[i]->GetKey2().fFlags > myScore))
                myScore = fBindings[i]->GetKey2().fFlags;

            if (myScore >= bestScore)
                result.Insert(0, fBindings[i]);
            else
                result.Append(fBindings[i]);
        }
    }
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:28,代码来源:plInputMap.cpp

示例4: FindEdges

void plInterMeshSmooth::FindEdges(hsTArray<plSpanHandle>& sets, hsTArray<uint16_t>* edgeVerts)
{
    int i;
    for( i = 0; i < sets.GetCount(); i++ )
    {
        const plSpan* span = sets[i].fDrawable->GetSpan(sets[i].fSpanIdx);
        if( !(span->fTypeMask & plSpan::kIcicleSpan) )
            continue;

        uint32_t nTris = sets[i].fDrawable->CvtGetNumTris(sets[i].fSpanIdx);
        uint16_t* idxList = sets[i].fDrawable->CvtGetIndexList(sets[i].fSpanIdx);
        uint32_t maxVertIdx = sets[i].fDrawable->CvtGetNumVerts(sets[i].fSpanIdx)-1;

        FindEdges(maxVertIdx, nTris, idxList, edgeVerts[i]);
    }
}
开发者ID:MareinK,项目名称:Plasma,代码行数:16,代码来源:plInterMeshSmooth.cpp

示例5: SubmitOccluders

bool plPipelineViewSettings::SubmitOccluders(const hsTArray<const plCullPoly*>& polyList)
{
    fCullPolys.SetCount(0);
    fCullHoles.SetCount(0);
    int i;
    for (i = 0; i < polyList.GetCount(); i++)
    {
        if (polyList[i]->IsHole())
            fCullHoles.Append(polyList[i]);
        else
            fCullPolys.Append(polyList[i]);
    }
    fCullTreeDirty = true;

    return true;
}
开发者ID:H-uru,项目名称:Plasma,代码行数:16,代码来源:plPipelineViewSettings.cpp

示例6: hsAssert

bool    plAnimComponent::GetKeyList( INode *restrictedNode, hsTArray<plKey> &outKeys )
{
    if( restrictedNode != nil )
    {
        if( fMods.find( (plMaxNode *)restrictedNode ) != fMods.end() )
        {
            outKeys.Append( fMods[ (plMaxNode *)restrictedNode ]->GetKey() );
            return true;
        }
        return false;
    }
    else
    {
        hsAssert( false, "DO SOMETHING!" );
        return false;
    }
}
开发者ID:H-uru,项目名称:Plasma,代码行数:17,代码来源:plAnimComponent.cpp

示例7: HarvestVisible

bool plPipelineViewSettings::HarvestVisible(plSpaceTree* space, hsTArray<int16_t>& visList)
{
    if (!space)
        return false;

    space->SetViewPos(GetViewPositionWorld());

    space->Refresh();

    if (fCullTreeDirty)
        RefreshCullTree();

    plProfile_BeginTiming(Harvest);
    fCullTree.Harvest(space, visList);
    plProfile_EndTiming(Harvest);

    return visList.GetCount() != 0;
}
开发者ID:H-uru,项目名称:Plasma,代码行数:18,代码来源:plPipelineViewSettings.cpp

示例8: SmoothNormals

void plInterMeshSmooth::SmoothNormals(hsTArray<plSpanHandle>& sets)
{
    hsTArray<uint16_t>* shareVtx = new hsTArray<uint16_t>[sets.GetCount()];
    hsTArray<uint16_t>* edgeVerts = new hsTArray<uint16_t>[sets.GetCount()];
    FindEdges(sets, edgeVerts);

    int i;
    for( i = 0; i < sets.GetCount()-1; i++ )
    {
        int j;
        for( j = edgeVerts[i].GetCount()-1; j >= 0; --j )
        {
            hsPoint3 pos = GetPosition(sets[i], edgeVerts[i][j]);
            hsVector3 normAccum = GetNormal(sets[i], edgeVerts[i][j]);;

            shareVtx[i].Append(edgeVerts[i][j]);

            int k;
            for( k = i+1; k < sets.GetCount(); k++ )
            {
                FindSharedVerts(pos, sets[k], edgeVerts[k], shareVtx[k], normAccum);
            }

            normAccum.Normalize();
            GetNormal(sets[i], edgeVerts[i][j]) = normAccum;

            for( k = i+1; k < sets.GetCount(); k++ )
            {
                SetNormals(sets[k], shareVtx[k], normAccum);
            }

            // Now remove all the shared verts (which we just processed)
            // from edgeVerts so we don't process them again.
            for( k = i; k < sets.GetCount(); k++ )
            {
                int m;
                for( m = 0; m < shareVtx[k].GetCount(); m++ )
                {
                    int idx = edgeVerts[k].Find(shareVtx[k][m]);
                    hsAssert(idx != edgeVerts[k].kMissingIndex, "Lost vertex between find and remove");
                    edgeVerts[k].Remove(idx);
                }
                shareVtx[k].SetCount(0);
            }
        }
    }

    delete [] shareVtx;
    delete [] edgeVerts;
}
开发者ID:MareinK,项目名称:Plasma,代码行数:50,代码来源:plInterMeshSmooth.cpp

示例9: GetSpaceTree

void plSceneNode::Harvest(plVolumeIsect* isect, hsTArray<plDrawVisList>& levList)
{
    static hsTArray<int16_t> visList;
    visList.SetCount(0);
    GetSpaceTree()->HarvestLeaves(isect, visList);
    static hsTArray<int16_t> visSpans;
    visSpans.SetCount(0);

    int i;
    for( i = 0; i < visList.GetCount(); i++ )
    {
        int idx = visList[i];
        fDrawPool[idx]->GetSpaceTree()->HarvestLeaves(isect, visSpans);
        if( visSpans.GetCount() )
        {
            plDrawVisList* drawVis = levList.Push();
            drawVis->fDrawable = fDrawPool[idx];
            drawVis->fVisList.Swap(visSpans);
        }
    }
}
开发者ID:Filtik,项目名称:Plasma,代码行数:21,代码来源:plSceneNode.cpp

示例10: CollectForRender

void plSceneNode::CollectForRender(plPipeline* pipe, hsTArray<plDrawVisList>& levList, plVisMgr* visMgr)
{
    static hsTArray<int16_t> visList;
    visList.SetCount(0);
    pipe->HarvestVisible(GetSpaceTree(), visList);
    static hsTArray<int16_t> visSpans;
    visSpans.SetCount(0);

    int i;
    for( i = 0; i < visList.GetCount(); i++ )
    {
        int idx = visList[i];
        if( pipe->PreRender(fDrawPool[idx], visSpans, visMgr) )
        {
            plDrawVisList* drawVis = levList.Push();
            drawVis->fDrawable = fDrawPool[idx];
            drawVis->fVisList.Swap(visSpans);
        }
    }
}
开发者ID:Filtik,项目名称:Plasma,代码行数:20,代码来源:plSceneNode.cpp

示例11: Dice

bool plGeoSpanDice::Dice(hsTArray<plGeometrySpan*>& spans) const
{
    int startingCount = spans.GetCount();

    hsTArray<plGeometrySpan*> out;
    hsTArray<plGeometrySpan*> next;

    while(spans.GetCount())
    {
        int i;
        for( i = 0; i < spans.GetCount(); i++ )
        {
            if( !IHalf(spans[i], next) )
            {
                out.Append(spans[i]);
            }
        }
        spans.Swap(next);
        next.SetCount(0);
    }
    spans.Swap(out);

    return spans.GetCount() != startingCount;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:24,代码来源:plGeoSpanDice.cpp

示例12: if

plCullNode::plCullStatus plCullNode::ISplitPoly(const plCullPoly& poly, 
                                                plCullPoly*& innerPoly, 
                                                plCullPoly*& outerPoly) const
{
    static hsTArray<float> depths;
    depths.SetCount(poly.fVerts.GetCount());

    static hsBitVector onVerts;
    onVerts.Clear();

    hsBool someInner = false;
    hsBool someOuter = false;
    hsBool someOn = false;
    int i;
    for( i = 0; i < poly.fVerts.GetCount(); i++ )
    {
        depths[i] = fNorm.InnerProduct(poly.fVerts[i]) + fDist;
        if( depths[i] < -kTolerance )
            someInner = true;
        else if( depths[i] > kTolerance )
            someOuter = true;
        else 
        {
            someOn = true;
            onVerts.SetBit(i);
        }
    }
    if( !(someInner || someOuter) )
    {
        (innerPoly = ScratchPolys().Push())->Init(poly);
        (outerPoly = ScratchPolys().Push())->Init(poly);
        return kSplit;
    }
    else if( !someInner )
    {
        IMarkClipped(poly, onVerts);
        return kClear;
    }
    else if( !someOuter )
    {
        IMarkClipped(poly, onVerts);
        return kCulled;
    }


    // Okay, it's split, now break it into the two polys
    (innerPoly = ScratchPolys().Push())->Init(poly);
    (outerPoly = ScratchPolys().Push())->Init(poly);

    static plCullPoly scrPoly;

    static hsBitVector inVerts;
    static hsBitVector outVerts;

    IBreakPoly(poly, depths,
        inVerts,
        outVerts,
        onVerts,
        scrPoly);

    static hsTArray<int> inPolyIdx;
    inPolyIdx.SetCount(0);
    static hsTArray<int> outPolyIdx;
    outPolyIdx.SetCount(0);

    for( i = 0; i < scrPoly.fVerts.GetCount(); i++ )
    {
        if( inVerts.IsBitSet(i) )
        {
            inPolyIdx.Append(i);
        }
        else if( outVerts.IsBitSet(i) )
        {
            outPolyIdx.Append(i);
        }
        else
        {
            inPolyIdx.Append(i);
            outPolyIdx.Append(i);
        }
    }

    ITakeHalfPoly(scrPoly, inPolyIdx, onVerts, *innerPoly);

    ITakeHalfPoly(scrPoly, outPolyIdx, onVerts, *outerPoly);

    return kSplit;
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:88,代码来源:plCullTree.cpp

示例13: setKeys

void plLeafController::setKeys(const hsTArray<hsKeyFrame*>& keys, unsigned int type) {
    DeallocKeys();
    AllocKeys(keys.getSize(), type);
    for (size_t i=0; i<keys.getSize(); i++)
        fKeys[i] = keys[i];
}
开发者ID:boq,项目名称:libhsplasma,代码行数:6,代码来源:plLeafController.cpp

示例14: RefreshCullTree

void plPipelineViewSettings::GetVisibleSpans(plDrawableSpans* drawable, hsTArray<int16_t>& visList, plVisMgr* visMgr)
{
    static hsTArray<int16_t> tmpVis;
    tmpVis.SetCount(0);
    visList.SetCount(0);

    drawable->GetSpaceTree()->SetViewPos(GetViewPositionWorld());

    drawable->GetSpaceTree()->Refresh();

    if (fCullTreeDirty)
        RefreshCullTree();

    const float viewDist = GetViewDirWorld().InnerProduct(GetViewPositionWorld());

    const hsTArray<plSpan *>    &spans = drawable->GetSpanArray();

    plProfile_BeginTiming(Harvest);
    if (visMgr)
    {
        drawable->SetVisSet(visMgr);
        fCullTree.Harvest(drawable->GetSpaceTree(), tmpVis);
        drawable->SetVisSet(nullptr);
    }
    else
    {
        fCullTree.Harvest(drawable->GetSpaceTree(), tmpVis);
    }

    // This is a big waste of time, As a desparate "optimization" pass, the artists
    // insist on going through and marking objects to fade or pop out of rendering
    // past a certain distance. This breaks the batching and requires more CPU to
    // check the objects by distance. Since there is no pattern to the distance at
    // which objects will be told not to draw, there's no way to make this hierarchical,
    // which is what it would take to make it a performance win. So they succeed in
    // reducing the poly count, but generally the frame rate goes _down_ as well.
    // Unfortunately, this technique actually does work in a few key areas, so
    // I haven't been able to purge it.
    if (fPipeline->IsDebugFlagSet(plPipeDbg::kFlagSkipVisDist))
    {
        int i;
        for (i = 0; i < tmpVis.GetCount(); i++)
        {
            if (spans[tmpVis[i]]->fSubType & fSubDrawableTypeMask)
            {
                visList.Append(tmpVis[i]);
            }
        }
    }
    else
    {
        int i;
        for (i = 0; i < tmpVis.GetCount(); i++)
        {
            if (spans[tmpVis[i]]->fSubType & fSubDrawableTypeMask)
            {
                // We'll check here for spans we can discard because they've completely distance faded out.
                // Note this is based on view direction distance (because the fade is), rather than the
                // preferrable distance to camera we sort by.
                float minDist, maxDist;
                if (drawable->GetSubVisDists(tmpVis[i], minDist, maxDist))
                {
                    const hsBounds3Ext& bnd = drawable->GetSpaceTree()->GetNode(tmpVis[i]).fWorldBounds;
                    hsPoint2 depth;
                    bnd.TestPlane(GetViewDirWorld(), depth);

                    if ((0 < minDist + viewDist - depth.fY) ||(0 > maxDist + viewDist - depth.fX))
                        continue;
                }

                visList.Append(tmpVis[i]);
            }
        }
    }
    plProfile_EndTiming(Harvest);
}
开发者ID:H-uru,项目名称:Plasma,代码行数:76,代码来源:plPipelineViewSettings.cpp

示例15: SetNormals

void plInterMeshSmooth::SetNormals(plSpanHandle& set, hsTArray<uint16_t>& shareVtx, hsVector3& norm)
{
    int i;
    for( i = 0; i < shareVtx.GetCount(); i++ )
        GetNormal(set, shareVtx[i]) = norm;
}
开发者ID:MareinK,项目名称:Plasma,代码行数:6,代码来源:plInterMeshSmooth.cpp


注:本文中的hsTArray类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。