/// <summary>
        /// Get the position of the specified eye in the specified
        /// coordinate space.
        /// </summary>
        ///
        /// <param name="eye">
        /// The eye (left, right, or center) to retrieve the position for.
        /// </param>
        /// <param name="coordinateSpace">
        /// The coordinate space (Tracker, Display, Viewport, or Camera)
        /// to retrieve the eye position in.
        /// </param>
        ///
        /// <returns>
        /// The position of the specified eye in the specified
        /// coordinate space.
        /// </returns>
        public Vector3 GetEyePosition(
            ZEye eye, ZCoordinateSpace coordinateSpace)
        {
            ZVector3 eyePosition;

            ZPlugin.LogOnError(ZPlugin.GetFrustumEyePosition(
                                   this._nativePtr, eye, coordinateSpace, out eyePosition),
                               "GetFrustumEyePosition");

            return(eyePosition.ToVector3());
        }
Esempio n. 2
0
        ////////////////////////////////////////////////////////////////////////
        // Public Methods
        ////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets the transformation matrix that represents the mapping
        /// between two specified coordinate spaces.
        /// </summary>
        ///
        /// <param name="from">
        /// The coordinate space to map from.
        /// </param>
        /// <param name="to">
        /// The coordinate space to map to.
        /// </param>
        ///
        /// <returns>
        /// The coordinate space transformation matrix.
        /// </returns>
        public Matrix4x4 GetCoordinateSpaceTransform(
            ZCoordinateSpace from, ZCoordinateSpace to)
        {
            if (from == to)
            {
                return(Matrix4x4.identity);
            }

            ZMatrix4 matrix;

            ZPlugin.LogOnError(ZPlugin.GetCoordinateSpaceTransform(
                                   this._nativePtr, from, to, out matrix),
                               "GetCoordinateSpaceTransform");

            return(matrix.ToMatrix4x4());
        }