Esempio n. 1
0
void cMesh2D::CreateVertexVec()
{
    for(int i=0; i<(int)mvPos.size(); i++)
        {
            mvVtx[0].push_back(cVertex(cVector3f(mvPos[i].x,mvPos[i].y,0),mvTexCoord[i],mvColor[i]));
        }

    CalculateEdges(eTileRotation_0,mvVtx[0],mvEdgeIndex);
}
Esempio n. 2
0
void cMesh2D::CreateTileVertexVec()
{
    int i;
    CreateVertexVec();

    for(i=1; i<eTileRotation_LastEnum; i++)
        {
            mvVtx[i]=mvVtx[0];
        }

    //--- Create the angles;---
    for(int angle=1; angle<4; angle++)
        {
            for(i=0; i<(int)mvVtx[0].size(); i++)
                {
                    float fAngle = ((float)angle)*kPi2f;
                    mvVtx[angle][i].pos.x = cos(fAngle)*mvVtx[0][i].pos.x -
                                            sin(fAngle)*mvVtx[0][i].pos.y;

                    mvVtx[angle][i].pos.y = sin(fAngle)*mvVtx[0][i].pos.x +
                                            cos(fAngle)*mvVtx[0][i].pos.y;

                }
            //Can use same edge index here since order has not changed.
            CalculateEdges((eTileRotation)angle,mvVtx[angle],mvEdgeIndex);
        }


    // SKIP THESE FOR NOW
    // The edges are not calculated correctly..and I din't think they are that needed.
    /*//--- Flip horizontally ---
    for(i=0;i<(int)mvVtx[0].size();i++)
    	mvVtx[4][i].pos.x = -mvVtx[0][i].pos.x;
    CalculateEdges(eTileRotation_FlipH, mvVtx[4], mvEdgeIndex);


    //--- Flip vertically ---
    for(i=0;i<(int)mvVtx[0].size();i++)
    	mvVtx[5][i].pos.y = -mvVtx[0][i].pos.y;
    CalculateEdges(eTileRotation_FlipV,mvVtx[5],InvEdgeIndex);


    //--- Flip vertically and horizontal---
    for(i=0;i<(int)mvVtx[0].size();i++)
    {
    	mvVtx[6][i].pos.y = -mvVtx[0][i].pos.y;
    	mvVtx[6][i].pos.x = -mvVtx[0][i].pos.x;

    }
    //The two flips make it right again. No need to reverse
    CalculateEdges(eTileRotation_FlipHV,mvVtx[6],mvEdgeIndex);*/
}
Esempio n. 3
0
void doms_only(BOOL always)
{
    int dfsCount = 0;
    int i;
    int n = blockCount;
    (void)always;
    if (always)
    {
        criticalThunks = NULL;
        criticalThunkPtr = &criticalThunks;
    }
    WalkFlowgraph(blockArray[0], RemoveCriticalEdges, TRUE);
    if (blockCount != n)
    {
        QUAD *head = intermed_head;
        blockArray = oAlloc(sizeof(BLOCK *) * (blockCount + 1000)); // fixme...
        while (head)
        {
            if (head->dc.opcode == i_block)
            {
                blockArray[head->dc.v.label] = head->block ;
            }
            head = head->fwd ;
        }
        head = criticalThunks;
        while (head)
        {
            if (head->dc.opcode == i_block)
            {
                blockArray[head->dc.v.label] = head->block ;
            }
            head = head->fwd ;
        }
        *criticalThunkPtr = Alloc(sizeof(QUAD));
        (*criticalThunkPtr)->dc.opcode = i_label;
        (*criticalThunkPtr)->dc.v.label = -1;
        criticalThunkPtr = (QUAD **)*criticalThunkPtr;
    }
    CancelInfinite(blockCount);
    for (i=1; i < blockCount; i++)
    {
        if (blockArray[i])
        {
            removeDeadBlock(blockArray[i]);
            blockArray[i]->idom = 0;
            blockArray[i]->dominates = NULL;
        }
    }
    Dominators();
    PostDominators();
    for (i=0; i < blockCount; i++)
    {
        if (blockArray[i])
        {
            blockArray[i]->visiteddfst = blockArray[i]->pred != NULL;
            blockArray[i]->dominanceFrontier = NULL;
        }
    }
    DominanceFrontier(blockArray[0], &dfsCount);
    CalculateEdges(blockArray[0]);
    BuildLoopTree();
}