Hi need help with the code.

https://dankonoy.com/9/progdirectx9/...my-chastic.htm

At the end describes how to obtain the distance now I need to get it !


if((NumVertices == 1201 && primCount == 1279)){




if (SpriteCreated1 == FALSE)
{
D3DXAssembleShader(ShaderAdd, sizeof(ShaderAdd), NULL, NULL, 0, &ShaderBufferAdd, NULL);
pDevice->CreatePixelShader((const DWORD*)ShaderBufferAdd->GetBufferPointer(), &sAdd);
ShaderBufferAdd->Release();

D3DXCreateTextureFromFile( pDevice, "target.png", &IMAGE1 );
SpriteCreated1 = TRUE;
}

bool SpriteCreated1 = false;
LPDIRECT3DTEXTURE9 IMAGE1;
LPD3DXSPRITE SPRITE1 = NULL;
IDirect3DPixelShader9 *sAdd = NULL;
char ShaderAdd[] = "ps.1.0 def c0, 0.0f, 0.0f, 0.0f, 0.0f tex t0 add r0, c0, t0";
ID3DXBuffer *ShaderBufferAdd = NULL;
LPDIRECT3DSTATEBLOCK9 pStateBlock = NULL;
float pSize = 5; //pic size

D3DXCreateSprite( pDevice, &SPRITE1 );
SPRITE1->Begin( D3DXSPRITE_ALPHABLEND | -50);
SPRITE1->Draw( IMAGE1, NULL, NULL, NULL, 0xFFFFFFFFF );
SPRITE1->End( );


if( SPRITE1 != NULL ){ SPRITE1->Release(); SPRITE1 = NULL; }

LPDIRECT3DSTATEBLOCK9 pStateBlock = NULL;
pDevice->CreateStateBlock( D3DSBT_ALL, &pStateBlock );
pStateBlock->Capture();

pDevice->SetTexture( 0, IMAGE1);
pDevice->SetPixelShader(sAdd);
pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
pDevice->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
pDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, 1);

pDevice->SetRenderState(D3DRS_POINTSIZE, *((DWORD*)&pSize));


pDevice->DrawPrimitive(D3DPT_POINTLIST, 0, 10);


pStateBlock->Apply();
pStateBlock->Release();
}