public ZFrustum(ZViewport viewport, IntPtr nativePtr)
            : base(nativePtr)
        {
            this._viewport = viewport;

            this.CameraOffset       = DefaultCameraOffset;
            this.DisplayEulerAngles = ZDisplay.DefaultEulerAngles;
            this.PortalModeFlags    = ZPortalMode.None;
        }
Example #2
0
        /// <summary>
        /// Creates an instance of the ZViewport class at the specified
        /// virtual desktop position.
        /// </summary>
        ///
        /// <param name="position">
        /// The (x, y) virtual desktop position in pixels corresponding
        /// to the viewport's top-left corner.
        /// </param>
        ///
        /// <returns>
        /// An instance of the ZViewport class.
        /// </returns>
        public ZViewport CreateViewport(Vector2Int position)
        {
            // Create the viewport.
            IntPtr viewportNativePtr;

            ZPlugin.LogOnError(
                ZPlugin.CreateViewport(this._nativePtr, out viewportNativePtr),
                "CreateViewport");

            ZViewport viewport = new ZViewport(viewportNativePtr);

            viewport.Position = position;

            // Update the context to ensure the appropriate display
            // angle has been passed to the viewport's frustum.
            this.Update();

            // Initialize the frustum.
            ZFrustum frustum = viewport.Frustum;

            frustum.HeadPose = frustum.DefaultHeadPose;

            return(viewport);
        }