Exemple #1
0
        public void SetTexture(ref Texture_t texture)
        {
            EVROverlayError err = NexHudEngine.OverlayManager.SetOverlayTexture(_handle, ref texture);

            if (err != EVROverlayError.None)
            {
                NexHudEngine.Log("Failed to send texture: " + err.ToString());
            }

            if (_hasBackSide)
            {
                err = NexHudEngine.OverlayManager.SetOverlayTexture(_backSideHandle, ref texture);

                if (err != EVROverlayError.None)
                {
                    NexHudEngine.Log("Failed to send texture: " + err.ToString());
                }
            }
        }
Exemple #2
0
        public void SetDeviceAttachment(uint index, Vector3 position, Vector3 rotation)
        {
            if (!_ingame)
            {
                throw new Exception("Cannot set attachment for dashboard overlay");
            }

            _position = position;
            _rotation = rotation;

            HmdMatrix34_t matrix = GetMatrixFromPositionAndRotation(position, rotation);

            EVROverlayError err = NexHudEngine.OverlayManager.SetOverlayTransformTrackedDeviceRelative(_handle, index, ref matrix);

            if (err != EVROverlayError.None)
            {
                NexHudEngine.Log("Failed to attach " + Key + " to Device " + index + " failed: " + err.ToString());
            }
        }
Exemple #3
0
        void CreateOverlayInSteamVR()
        {
            EVROverlayError ovrErr = EVROverlayError.None;

            if (NexHudEngine.OverlayManager == null)
            {
                throw new Exception("NexHud Engine is not started");
            }

            if (_ingame)
            {
                ovrErr = NexHudEngine.OverlayManager.CreateOverlay(Key, Name, ref _handle);
                //   ToggleInput(false);
            }
            else
            {
                ovrErr = NexHudEngine.OverlayManager.CreateDashboardOverlay(Key, Name, ref _handle, ref _thumbnailHandle);
                //   ToggleInput(true);
            }

            NexHudEngine.Log("Overlay Handle " + _handle + ", Thumbnail Handle: " + _thumbnailHandle);

            if (ovrErr != EVROverlayError.None)
            {
                throw new Exception("Failed to create overlay: " + ovrErr.ToString());
            }

            NexHudEngine.OverlayManager.SetOverlayColor(_handle, 1.0f, 1.0f, 1.0f);

            if (_hasBackSide)
            {
                ovrErr = NexHudEngine.OverlayManager.CreateOverlay(Key + "_backside", Name, ref _backSideHandle);

                if (ovrErr != EVROverlayError.None)
                {
                    throw new Exception("Failed to create backside of overlay: " + ovrErr.ToString());
                }
                NexHudEngine.OverlayManager.SetOverlayColor(_backSideHandle, 1.0f, 1.0f, 1.0f);

                HmdMatrix34_t matrix = GetMatrixFromPositionAndRotation(new Vector3(0, 0, 0), new Vector3(0, 180, 0));
                NexHudEngine.OverlayManager.SetOverlayTransformOverlayRelative(_backSideHandle, _handle, ref matrix);
            }

            Alpha = 1.0f;


            // Because it'll be upside down otherwise.
            VRTextureBounds_t bounds;

            bounds.vMax = 0; bounds.vMin = 1;  // Flip the Y

            // Leave as defaults
            bounds.uMin = 0;
            bounds.uMax = 1;

            NexHudEngine.OverlayManager.SetOverlayTextureBounds(_handle, ref bounds);

            if (_hasBackSide)
            {
                bounds.uMin = 1; bounds.uMax = 0; // Flip the backside texture
                NexHudEngine.OverlayManager.SetOverlayTextureBounds(_backSideHandle, ref bounds);
            }
        }