Axiom.Core.Camera.SetWindowImpl C# (CSharp) Метод

SetWindowImpl() защищенный Метод

Do actual window setting, using parameters set in SetWindow call.
The method is called after projection matrix each change.
protected SetWindowImpl ( ) : void
Результат void
        protected void SetWindowImpl()
        {
            if (!isWindowSet || !recalculateWindow)
            {
                return;
            }

            // Calculate general projection parameters
            Real vpLeft, vpRight, vpBottom, vpTop;
            CalculateProjectionParameters(out vpLeft, out vpRight, out vpBottom, out vpTop);

            float vpWidth = vpRight - vpLeft;
            float vpHeight = vpTop - vpBottom;

            float wvpLeft = vpLeft + windowLeft * vpWidth;
            float wvpRight = vpLeft + windowRight * vpWidth;
            float wvpTop = vpTop - windowTop * vpHeight;
            float wvpBottom = vpTop - windowBottom * vpHeight;

            Vector3 vpUpLeft = new Vector3(wvpLeft, wvpTop, -Near);
            Vector3 vpUpRight = new Vector3(wvpRight, wvpTop, -Near);
            Vector3 vpBottomLeft = new Vector3(wvpLeft, wvpBottom, -Near);
            Vector3 vpBottomRight = new Vector3(wvpRight, wvpBottom, -Near);

            Matrix4 inv = _viewMatrix.Inverse();

            Vector3 vwUpLeft = inv.TransformAffine(vpUpLeft);
            Vector3 vwUpRight = inv.TransformAffine(vpUpRight);
            Vector3 vwBottomLeft = inv.TransformAffine(vpBottomLeft);
            Vector3 vwBottomRight = inv.TransformAffine(vpBottomRight);

            windowClipPlanes.Clear();

            if (ProjectionType == Projection.Perspective)
            {
                Vector3 pos = GetPositionForViewUpdate();

                windowClipPlanes.Add(new Plane(pos, vwBottomLeft, vwUpLeft));
                windowClipPlanes.Add(new Plane(pos, vwUpLeft, vwUpRight));
                windowClipPlanes.Add(new Plane(pos, vwUpRight, vwBottomRight));
                windowClipPlanes.Add(new Plane(pos, vwBottomRight, vwBottomLeft));
            }
            else
            {
                Vector3 x_axis = new Vector3(inv.m00, inv.m01, inv.m02);
                Vector3 y_axis = new Vector3(inv.m10, inv.m11, inv.m12);
                x_axis.Normalize();
                y_axis.Normalize();

                windowClipPlanes.Add(new Plane(x_axis, vwBottomLeft));
                windowClipPlanes.Add(new Plane(-x_axis, vwUpRight));
                windowClipPlanes.Add(new Plane(y_axis, vwBottomLeft));
                windowClipPlanes.Add(new Plane(-y_axis, vwUpLeft));
            }

            recalculateWindow = false;
        }