this is the simplest way of doing 3d boxes <3
declare these in some header file
Code:
LPD3DXMESH pSphereMesh = NULL;
LPD3DXMESH pBoxMesh = NULL;
D3DXMATRIX ObjWorldMatrices;
D3DXMATRIX SavedMatrices;
LPDIRECT3DTEXTURE9 tRed = NULL;
LPDIRECT3DTEXTURE9 tBlue = NULL;
const BYTE bRed[] = {0x42, 0x4D, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00};
const BYTE bBlue[] = {0x42, 0x4D, 0x3A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00};
then in some initializing procedure that u have, initialize these
Code:
D3DXCreateSphere( pDevice, 155.0f, 8, 7, &pSphereMesh, 0);
D3DXCreateBox( pDevice,100,322,100, &pBoxMesh, 0);
D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&bRed , sizeof(bRed) , &tRed );
D3DXCreateTextureFromFileInMemory(pDevice, (LPCVOID)&bBlue , sizeof(bBlue) , &tBlue );
then in your ESP loop
do a simple calculation to where to put the bounding sphere or box..
an easy solution would be to calculate the midpoint of the model creation endpoints found in the object class, thats pointed to by the player class
Code:
D3DXVECTOR3 GetMidPoint(D3DXVECTOR3 V1,D3DXVECTOR3 V2)
{
D3DXVECTOR3 Mid;
Mid.x = (V1.x+V2.x)/2;
Mid.y = (V1.y+V2.y)/2;
Mid.z = (V1.z+V2.z)/2;
return Mid;
}
then when its time to render the sphere ESP/Box ESP
set the texture based on the team check you made and call one of these wrapper functions i wrote
Code:
void DrawSphere(D3DXVECTOR3 Pos)
{
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
pDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_NEVER );
pDevice->GetTransform(D3DTS_WORLD, &SavedMatrices );
D3DXMatrixTranslation(&ObjWorldMatrices, Pos.x, Pos.y, Pos.z);
pDevice->SetTransform(D3DTS_WORLD, &ObjWorldMatrices);
pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_WIREFRAME);
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
pDevice->SetRenderState( D3DRS_FOGENABLE, false );
pSphereMesh->DrawSubset(0);
pDevice->SetTransform(D3DTS_WORLD, &SavedMatrices );
}
void Draw3DBox(D3DXVECTOR3 Pos)
{
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
pDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_NEVER );
pDevice->GetTransform(D3DTS_WORLD, &SavedMatrices );
D3DXMatrixTranslation(&ObjWorldMatrices, Pos.x, Pos.y, Pos.z);
pDevice->SetTransform(D3DTS_WORLD, &ObjWorldMatrices);
pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_WIREFRAME);
pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
pDevice->SetRenderState( D3DRS_FOGENABLE, false );
pBoxMesh->DrawSubset(0);
pDevice->SetTransform(D3DTS_WORLD, &SavedMatrices );
}
and there you go, thats a simple box ESP/sphere ESP or wt ever other shap you want to use from the directx create() .. heck you can even make a teapot ESP xD
there you go, have fun
NOTE: this is as noob friendly as possible, please dont embarrass your self by sending me a PM, i will not answer
EDIT: @
mods feel free to move this post to a thread of its own if you feel its necessary