Exemplo n.º 1
0
        /// <summary>
        /// Update the master pose sent to ALL applications.
        ///
        /// when called initialy, having the flags set to 0 will return the current pose (which includes resolution - which you might need)
        /// If you wish to change the pose, change the parts of the structures you need to, and set the appropriate flag to update.
        /// atm, the flags will be for Pose, Stage, Clipping Plane, and resolution.
        ///
        /// </summary>
        /// <param name="setframe"></param>
        /// <returns>The current pose - could be yours, someone elses, or a combination</returns>

        public static bool UpdateInputFrame(ref SDKInputFrame setframe)
        {
            if (_injection_SDKInputFrame.active && _injection_SDKInputFrame.action != null)
            {
                _injection_SDKInputFrame.action.Invoke();
                setframe = _injection_SDKInputFrame.data;
            }
            else
            {
                // Pin the object briefly so we can send it to the API without it being accidentally garbage collected
                GCHandle gch       = GCHandle.Alloc(setframe, GCHandleType.Pinned);
                IntPtr   structPtr = updatinputframe(gch.AddrOfPinnedObject());
                gch.Free();

                if (structPtr == IntPtr.Zero)
                {
                    setframe = SDKInputFrame.empty;
                    return(false);
                }

                setframe = (SDKInputFrame)Marshal.PtrToStructure(structPtr, typeof(SDKInputFrame));
                _injection_SDKInputFrame.data = setframe;
            }

            return(true);
        }
Exemplo n.º 2
0
        public static void SetCamera(Camera camera, Transform cameraTransform, SDKInputFrame inputFrame, Matrix4x4 originLocalToWorldMatrix, int layerMask)
        {
            Vector3    worldPosition       = Vector3.zero;
            Quaternion worldRotation       = Quaternion.identity;
            float      verticalFieldOfView = inputFrame.pose.verticalFieldOfView;
            float      nearClipPlane       = inputFrame.pose.nearClipPlane;
            float      farClipPlane        = inputFrame.pose.farClipPlane;
            Matrix4x4  projectionMatrix    = inputFrame.pose.projectionMatrix;

            GetCameraPositionAndRotation(inputFrame.pose, originLocalToWorldMatrix, out worldPosition, out worldRotation);

            cameraTransform.position = worldPosition;
            cameraTransform.rotation = worldRotation;
            camera.fieldOfView       = verticalFieldOfView;
            camera.nearClipPlane     = nearClipPlane;
            camera.farClipPlane      = farClipPlane;
            camera.projectionMatrix  = projectionMatrix;
            camera.cullingMask       = layerMask;
        }
Exemplo n.º 3
0
        }                                                                                              // 0x000000018113C2D0-0x000000018113C6A0

        public static void SetCamera(Camera camera, SDKInputFrame inputFrame, Matrix4x4 originLocalToWorldMatrix, int layerMask)
        {
        }                                                                                                    // 0x000000018113DB70-0x000000018113E150
Exemplo n.º 4
0
 public static bool UpdateInputFrame(ref SDKInputFrame setframe) => default; // 0x0000000181809FA0-0x000000018180A680