Exemplo n.º 1
0
void IFXCharacter::GenerateBoneLinks(I32 defaultnumber)
{
	ForEachNode(IFXCHILDFIRST,&IFXCharacter::CreateLinksOnNode,&defaultnumber);
	GetSkin()->RelinkWeights();
	GetSkin()->FilterWeights();

	RecalcLinks();
	ForEachNodeTransformed(IFXPARENTFIRST|IFXSTORE_XFORM,NULL);
	ForEachNode(IFXCHILDFIRST,&IFXCharacter::CalcLinkReferencesOnNode);

	GetSkin()->ComputeVertexOffsets();
}
Exemplo n.º 2
0
/******************************************************************************
non-link bones
******************************************************************************/
I32 IFXCharacter::CountRealBones(void)
{
	I32 bones=0;

	ForEachNode(IFXCHILDFIRST,&IFXCharacter::CountRealBone,&bones);

	return bones;
}
Exemplo n.º 3
0
void IFXCharacter::BlendBones(F32 weight)
{
	F32 weight2=weight;
	if(weight2<0.0f)
		weight2=0.0f;
	if(weight2>1.0f)
		weight2=1.0f;

	ForEachNode(IFXCHILDFIRST,&IFXCharacter::BlendBoneNode,&weight2);
}
Exemplo n.º 4
0
void TreeOptimizer::step2()
{//make select and product into a join
	NodePairs pairs;
	NodeCallBack cb = boost::BOOST_BIND(GetMergeNodes, _1, _2, _3, boost::ref(pairs));
	ForEachNode(root, cb);

	BOOST_FOREACH(NodePairs::value_type val , pairs)
	{
		val.first->setType(JOIN);
		val.first->children = val.second->children;
	}
Exemplo n.º 5
0
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    void Print(CallGraph* callGraph, Unit* unit) {
        // Print the external and unknown nodes.
        NewNode(ExternalCallNode::GetExternalNode(), "EXTERNAL", 
                COLOR_LIGHT_PINK, SHAPE_RECT);
        NewNode(UnknownCallNode::GetUnknownNode(), "UNKNOWN", 
                COLOR_LIGHT_GREEN, SHAPE_RECT);

        // Print the nodes for each function, then create the links.
        for(auto funct = unit->Functions().First(); funct; funct = funct->Next) {
            auto functionRef = GetFunctionReference(funct->Value, unit);
            auto node = callGraph->GetNode(functionRef);
            NewNode(node, *funct->Value->Name(), COLOR_LIGHT_BLUE, SHAPE_TRAPEZIUM);

            node->ForEachCallSite([this](CallSite* site) -> bool {
                string name = string::Format(L"%d", site->GetCallId());
                NewNode(site, name, COLOR_LIGHT_GREY, SHAPE_ELLIPSE);
                return true;
            });
        }

        auto& nodeGroups = callGraph->GetCallNodeGroups();

        for(int i = 0; i < nodeGroups.Count(); i++) {
            auto nodeGroup = nodeGroups[i];
            string name = string::Format(L"Group: %d", nodeGroup->NodeCount());
            NewNode(nodeGroup, name, COLOR_YELLOW, SHAPE_DIAMOND);

            nodeGroup->ForEachNode([this, nodeGroup](CallNodeBase* node) -> bool {
                Link(nodeGroup, node);
                return true;
            });
        }

        for(auto funct = unit->Functions().First(); funct; funct = funct->Next) {
            auto functionRef = GetFunctionReference(funct->Value, unit);
            auto node = callGraph->GetNode(functionRef);
            CreateLinks(node);
        }

        CreateLinks(ExternalCallNode::GetExternalNode());
        CreateLinks(UnknownCallNode::GetUnknownNode());
        Close();
    }
Exemplo n.º 6
0
void
Profiler::ForEachNode(Phase tag, TypeNode *node, FVisit visit, Phase parentTag)
{
    AssertMsg(node != NULL, "Invalid usage: node must always be non null");

    for(int i = 0; i < PhaseCount; i++)
    {
        if(node->ChildExistsAt(i))
        {
            TypeNode * child = node->GetChildAt(i);
            if(i == tag)
            {
                visit(child, parentTag);
            }
            else
            {
                ForEachNode(tag, child, visit, static_cast<Phase>(i));
            }
        }
    }
}
Exemplo n.º 7
0
void TreeOptimizer::step1()
{//fill in select exp
	NodeCallBack cb = boost::BOOST_BIND(FillInSelect, _1, _2, _3);
	ForEachNode(root, cb);
}
Exemplo n.º 8
0
void
Profiler::Print(Phase baseTag)
{
    if (baseTag == InvalidPhase)
    {
        baseTag = AllPhase;     // default to all phase
    }
    const TimeStamp freq = this->GetFrequency();

    bool foundNode = false;
    ForEachNode(baseTag, &rootNode, [&](TypeNode *const baseNode, const Phase parentTag)
    {
        if(!foundNode)
        {
            foundNode = true;
            Output::Print(L"%-*s:%7s %5s %7s %5s %7s %7s %5s\n",
                          (Profiler::PhaseNameWidth-0),
                          L"Profiler Report",
                          L"Incl",
                          L"(%)",
                          L"Excl",
                          L"(%)",
                          L"Max",
                          L"Mean",
                          L"Count"
                         );
            Output::Print(L"-------------------------------------------------------------------------------\n");
        }

        UnitData *data      = baseNode->GetValue();

        if(0 == data->count)
        {
            Output::Print(L"The phase : %s was never started", PhaseNames[baseTag]);
            return;
        }

        int indent = 0;

        if(parentTag != InvalidPhase)
        {
            TypeNode *const parentNode = baseNode->GetParent();
            Assert(parentNode);

            Output::Print(L"%-*s\n", (Profiler::PhaseNameWidth-0), PhaseNames[parentTag]);
            indent += Profiler::TabWidth;
        }

        if(indent)
        {
            Output::SkipToColumn(indent);
        }
        Output::Print(L"%-*s %7.1f %5d %7.1f %5d %7.1f %7.1f %5d\n",
                      (Profiler::PhaseNameWidth-indent),
                      PhaseNames[baseTag],
                      (double)data->incl / freq ,                 // incl
                      int(100),                                   // incl %
                      (double)data->excl / freq ,                 // excl
                      int(data->excl * 100 / data->incl ),        // excl %
                      (double)data->max  / freq ,                 // max
                      (double)data->incl / ( freq * data->count ),// mean
                      int(data->count)                            // count
                     );
        indent += Profiler::TabWidth;

        PrintTree(baseNode, baseNode, indent, freq);
    });

    if(foundNode)
    {
        Output::Print(L"-------------------------------------------------------------------------------\n");
        Output::Flush();
    }
}
Exemplo n.º 9
0
void IFXCharacter::RecalcLinks(void)
{
	ForEachNode(IFXPARENTFIRST,&IFXCharacter::RecalcLinksOnNode);
}
Exemplo n.º 10
0
void IFXCharacter::RebuildBoneTable(void)
{
	ClearBoneTable();
	ForEachNode(IFXCHILDFIRST,&IFXCharacter::AddBoneToTable,this);
}
Exemplo n.º 11
0
void IFXCharacter::RemoveBoneLinks(void)
{
	ForEachNode(IFXCHILDFIRST,&IFXCharacter::RemoveBoneLinkNode,0);
	RebuildBoneTable();
}
Exemplo n.º 12
0
void IFXCharacter::ResetToFullReach(void)
{
	ForEachNode(IFXPARENTFIRST,&IFXCharacter::ResetToFullReachOnNode);
}
Exemplo n.º 13
0
void IFXCharacter::ResetToReference(void)
{
	ForEachNode(IFXPARENTFIRST,&IFXCharacter::ResetToReferenceOnNode);
}