jeudi 30 janvier 2014

[Question] i wonder why drawline function is getting me this for drawing a skeleton topic




ok first lets have a look in the drawprimitive function for the line that i use



PHP Code:







void DrawPhokingSkeleton(IDirect3DDevice9* m_pD3Ddev, float X, float Y, float Xx, float Yy, float width, D3DCOLOR Color)
{
    
D3DTLVERTEX qV[2] = {
        { (float)
Xx, (float)Yy, 0.0f, 1.0f, Color },
        { (float)
X, (float)Y, 0.0f, 1.0f, Color }    
    };
    const 
DWORD D3DFVF_TL = D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1;
    
m_pD3Ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
    
m_pD3Ddev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
    
m_pD3Ddev->SetFVF(D3DFVF_TL);
    
m_pD3Ddev->SetTexture(0, Primitive);
    
m_pD3Ddev->DrawPrimitiveUP(D3DPT_LINELIST, 1, qV, sizeof(D3DTLVERTEX));
} 









then let's have a look into the phucking function that i use to get the crappy bones ^^... Tell me if i have too many :D i draw a box if ennemy is more than 50 and then it changes to skeleton if closer.. cause i expect lags if i draw only phoking skeletons :P


PHP Code:







//..............rest of function.........
pSoldier->GetTransform(&mTransform);
        
D3DXVECTOR3 vTargetPosition = mTransform.m[3];
         
distance = Vdistance(pSoldier, lSoldier);
        if (
WorldToScreen2(&vTargetPosition)) {
            
D3DXVECTOR3* vBones = new D3DXVECTOR3[0xD0];
            if(
pPlayer && distance < 50)//->m_teamId != lPlayer->m_teamId)
            
{
                for (
unsigned int i = 0; i < 0xD0; i++)
                {
                    if (
i>1 )
                    {
                        if(
pControlled->isVisible())
                        {
                            
DrawPhokingSkeleton(dx_Device, vBones[i].x, vBones[i].y, vBones[i - 1].x, vBones[i - 1].y,18, Red);
                        }
                        else
                        {
                            
DrawPhokingSkeleton(dx_Device, vBones[i].x, vBones[i].y, vBones[i - 1].x, vBones[i - 1].y, 18, orangetz2);
                        }        
                    }
                    
GetBone(pSoldier, &vBones[i], UpdatePoseResultData::rHips + i);
                    if (
WorldToScreen2(&vBones[i]))continue;
                }
//............rest of function....... 









:shrug:
i really wonder why the result look like that :





Aucun commentaire:

Enregistrer un commentaire