Is this
bool ConvertWorldSpaceToViewSpace(int Camera,int *ScreenX,int *ScreenY,float x,float y,float z){
D3DXMATRIX VM=dbGetViewMatrix(Camera);
D3DXMATRIX PM=dbGetProjectionMatrix(Camera);
D3DXMATRIX WVP;
D3DXMatrixMultiply(&WVP,&VM,&PM);
D3DXVECTOR3 pos=D3DXVECTOR3(x,y,z);
D3DXVECTOR3 result;
D3DXVec3TransformCoord(&result,&pos,&WVP);
if(result.z<1){
*ScreenX=(result.x+1)*dbScreenWidth()/2;
*ScreenY=(1-result.y)*dbScreenHeight()/2;
return true;
}
return false;
}
std::pair<int, int> ConvertWorldSpaceToViewSpace(int Camera,float x,float y,float z)
{
int ScreenX = 0;
int ScreenY = 0;
D3DXMATRIX VM=dbGetViewMatrix(Camera);
D3DXMATRIX PM=dbGetProjectionMatrix(Camera);
D3DXMATRIX WVP;
D3DXMatrixMultiply(&WVP,&VM,&PM);
D3DXVECTOR3 pos=D3DXVECTOR3(x,y,z);
D3DXVECTOR3 result;
D3DXVec3TransformCoord(&result,&pos,&WVP);
if(result.z<1){
ScreenX=(result.x+1)*dbScreenWidth()/2;
ScreenY=(1-result.y)*dbScreenHeight()/2;
}
return std::pair<int, int>( ScreenX, ScreenY );
}
written for Dark GDK or Dark Basic? I need it for Dark GDK To use so A person can click on a small object I am using as a button and have it pressed.
The quality of what a man gives without seeking anything in return shows his integrity.