Advertisement

THANKS A LOT "CGAMEPROGRAMMER"

Started by May 13, 2000 06:23 AM
-1 comments, last by MetalWorX 24 years, 7 months ago
Hi, i''ll call u CG!! well i have a small problem in the code u gave me for finding the 2d coords of an object. D3DMATRIX Temp; D3DMATRIX Final; float XTemp; float YTemp; float ZTemp; float WTemp; float RW; Temp = WorldMatrix * ViewMatrix; Final = Temp * ProjMatrix; // if X,Y,Z are the coordinates of the object // in world space: XTemp = (Final._11 * X) + (Final._21 * Y) + (Final._31 * Z) + Final._41; YTemp = (Final._12 * X) + (Final._22 * Y) + (Final._32 * Z) + Final._42; ZTemp = (Final._13 * X) + (Final._23 * Y) + (Final._33 * Z) + Final._43;WTemp = (Final._14 * X) + (Final._24 * Y) + (Final._34 * Z) + Final._44;RW = 1.0f / WTemp; ScreenX = (1.0f + (XTemp * RW)) * ScreenWidth / 2.0f; ScreenY = (1.0f - (YTemp * RW)) * ScreenHeight / 2.0f; ScreenZ = ZTemp * RW;ScreenW = WTemp; 1> when i''m in 640x480 i have to specify ScreenX = 640 - ScreenX for gettin my output. 2> the ScreenY values are all screwed up but they are kinda relative. ScreenX = (1.0f + (XTemp * RW)) * ScreenWidth / 2.0f; ScreenY = (1.0f - (YTemp * RW)) * ScreenHeight / 2.0f; in the above two lines why do you do (1.0f + (blah)) & (1.0f - (blah))??? what is 1.0???why do u finally divide by 2??? I need some help desparetely! please help me out/ and about the MSDN sample u had talked about,which sample r u refering to??is it available online???? thnx for sparing ur time!! sandeep_kl@mailcity.com
Raptor

This topic is closed to new replies.

Advertisement