Example #1
0
 static void PerspectiveScreen (const csVector3& v, csVector2& p,
   const CS::Math::Matrix4& camProj, float hw, float hh)
 {
   csVector4 v_proj (camProj * csVector4 (v, 1));
   p.x = (v_proj.x / v_proj.w + 1.0f) * hw;
   p.y = (v_proj.y / v_proj.w + 1.0f) * hh;
 }
Example #2
0
File: box.cpp Project: garinh/cs
static void Perspective (const csVector3& v, csVector2& p,
                         const CS::Math::Matrix4& proj, int screenWidth, int screenHeight)
{
    csVector4 v_proj (proj * csVector4 (v, 1));
    float inv_w = 1.0f/v_proj.w;
    p.x = (v_proj.x * inv_w + 1) * screenWidth/2;
    p.y = (v_proj.y * inv_w + 1) * screenHeight/2;
}