Esempio n. 1
0
    /// <summary>Handles the mouse down event</summary>
    private void frmHelloCube_MouseDown(object sender, MouseEventArgs e)
    {
        isDown = true;

        preCursorPosition.Set(PerDeg(e.X, ClientRectangle.Width), PerDeg(e.Y, ClientRectangle.Height), 0);
        cursorPosition.Set(PerDeg(e.X, ClientRectangle.Width), PerDeg(e.Y, ClientRectangle.Height), 0);

        this.Invalidate();
    }
Esempio n. 2
0
    /// <summary>
    /// Retrieves the camera vectors eye, at and up if this matrix would be a view matrix
    /// </summary>
    /// <param name="Eye"></param>
    /// <param name="At"></param>
    /// <param name="Up"></param>
    public void GetLookAt(ref SLVec3f Eye, ref SLVec3f At, ref SLVec3f Up)
    {
        SLMat4f invRot      = new SLMat4f(this);
        SLVec3f translation = new SLVec3f(m[12], m[13], m[14]);

        invRot.m[12] = 0;
        invRot.m[13] = 0;
        invRot.m[14] = 0;
        invRot.Transpose();
        Eye.Set(invRot.Multiply(-translation)); // vector to the eye
        Up.Set(m[1], m[5], m[9]);               // normalized look up vector
        At.Set(-m[2], -m[6], -m[10]);           // normalized look at vector
    }