Original Post
🔒 Locked
Coordinate Transform problem?
Advertisement
D3DVECTOR ProcessScreenCoords(D3DVECTOR point)
{
D3DVECTOR out;
//to calculate Coordinate Location of Mesh
Temp = m_matWorld * m_matView;
Final = Temp * m_matProj;
XTemp = (Final._11 * point.x) + (Final._21 * point.y) + (Final._31 * point.z) + Final._41;
YTemp = (Final._12 * point.x) + (Final._22 * point.y) + (Final._32 * point.z) + Final._42;
ZTemp = (Final._13 * point.x) + (Final._23 * point.y) + (Final._33 * point.z) + Final._43;
WTemp = (Final._14 * point.x) + (Final._24 * point.y) + (Final._34 * point.z) + Final._44;
RW = fAspect / WTemp;
out.x = (1.0f + (XTemp * RW)) * scrWidth / 2.0f;
out.y = (1.0f - (YTemp * RW)) * scrHeight / 2.0f;
//out.z = ZTemp * RW;
out.z = ScreenW = WTemp;
return out;
}
hope this helps!
Edited by - raptor on October 2, 2000 1:40:54 PM
{
D3DVECTOR out;
//to calculate Coordinate Location of Mesh
Temp = m_matWorld * m_matView;
Final = Temp * m_matProj;
XTemp = (Final._11 * point.x) + (Final._21 * point.y) + (Final._31 * point.z) + Final._41;
YTemp = (Final._12 * point.x) + (Final._22 * point.y) + (Final._32 * point.z) + Final._42;
ZTemp = (Final._13 * point.x) + (Final._23 * point.y) + (Final._33 * point.z) + Final._43;
WTemp = (Final._14 * point.x) + (Final._24 * point.y) + (Final._34 * point.z) + Final._44;
RW = fAspect / WTemp;
out.x = (1.0f + (XTemp * RW)) * scrWidth / 2.0f;
out.y = (1.0f - (YTemp * RW)) * scrHeight / 2.0f;
//out.z = ZTemp * RW;
out.z = ScreenW = WTemp;
return out;
}
hope this helps!
Edited by - raptor on October 2, 2000 1:40:54 PM
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement