Ejemplo n.º 1
0
        public void Create()
        {
            m_handle = Types.INVALID_HANDLE;

            if (!HvrHelper.Support.IsApplicationStateSupported())
            {
                return;
            }

            try
            {
                UnityInterface.Lock();

                if (HvrPlayerInterface.Initialise())
                {
                    m_handle = HvrPlayerInterfaceAPI.Actor_Create();

#if VERBOSE_LOGGING
                    Debug.Log("Create " + GetType().Name + " Handle:" + handle);
#endif

                    UnityInterface.SceneObjectsAdd(m_handle, GetType().Name + m_handle, GetType().FullName);
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
            }
            finally
            {
                UnityInterface.Unlock();
            }
        }
Ejemplo n.º 2
0
        public void Delete()
        {
            if (m_handle == Types.INVALID_HANDLE)
            {
                return;
            }

            try
            {
                UnityInterface.Lock();

                HvrPlayerInterfaceAPI.Actor_Delete(m_handle);

#if VERBOSE_LOGGING
                Debug.Log("Delete " + GetType().Name + " Handle:" + handle);
#endif

                UnityInterface.SceneObjectsRemove(m_handle);
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
            }
            finally
            {
                m_handle = Types.INVALID_HANDLE;

                UnityInterface.Unlock();
            }
        }
Ejemplo n.º 3
0
        public static string RenderMethod_GetDefaultMethodType()
        {
            StringBuilder stringBuilder = new StringBuilder(256);

            if (HvrPlayerInterfaceAPI.Interface_GetRenderMethodDefault(stringBuilder, stringBuilder.Capacity))
            {
                return(stringBuilder.ToString());
            }

            Debug.LogError("[HVR] Unable to get default rendermethod from interface");

            if (m_supportedRenderMethodTypes == null)
            {
                RenderMethod_UpdateSupportedTypes();
            }

            try
            {
                return(m_supportedRenderMethodTypes[0]);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Ejemplo n.º 4
0
 public static void CheckConnection()
 {
     if (m_connection_check_lastTime + CONNECTION_CHECK_WAIT_TIME < Helper.GetCurrentTime())
     {
         m_connection_check_lastTime = Helper.GetCurrentTime();
         HvrPlayerInterfaceAPI.Interface_Reconnect();
     }
 }
Ejemplo n.º 5
0
        public static void Update()
        {
            if (IsInitialized())
            {
                HvrPlayerInterfaceAPI.Interface_Update();

                UnityInterface.Update();
            }
        }
Ejemplo n.º 6
0
        public bool IsValid()
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return(false);
            }

            return(HvrPlayerInterfaceAPI.RenderMethod_IsValid(handle));
        }
        public void Seek(float time)
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return;
            }

            HvrPlayerInterfaceAPI.Asset_Seek(handle, time);
        }
Ejemplo n.º 8
0
        public void SetRenderMethod(int _renderMethodHandle)
        {
            if (m_handle == Types.INVALID_HANDLE)
            {
                return;
            }

            HvrPlayerInterfaceAPI.Actor_SetRenderMethod(m_handle, _renderMethodHandle);
        }
Ejemplo n.º 9
0
        public void SetReverseDepthEnabled(bool reverseDepthEnabled)
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return;
            }

            HvrPlayerInterfaceAPI.Viewport_SetReverseDepthEnabled(handle, reverseDepthEnabled ? 1 : 0);
        }
Ejemplo n.º 10
0
        public void SetDimensions(float x, float y, float width, float height)
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return;
            }

            HvrPlayerInterfaceAPI.Viewport_SetDimensions(handle, x, y, width, height);
        }
        public float GetActualTime()
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return(0);
            }

            return(HvrPlayerInterfaceAPI.Asset_GetActualTime(handle));
        }
Ejemplo n.º 12
0
        public void SetShaderSubroutines(string code)
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return;
            }

            HvrPlayerInterfaceAPI.RenderMethod_SetShaderSubroutines(handle, code);
        }
        public void Update(float absoluteTime)
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return;
            }

            HvrPlayerInterfaceAPI.Asset_Update(handle, absoluteTime);
        }
Ejemplo n.º 14
0
        public void SetSubroutineUniformFloat(string uniformName, float value)
        {
            if (m_handle == HVR.Interface.Types.INVALID_HANDLE)
            {
                return;
            }

            HvrPlayerInterfaceAPI.Actor_SetSubroutineUniformFloat(handle, uniformName, value);
        }
        public float GetDuration()
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return(0);
            }

            return(HvrPlayerInterfaceAPI.Asset_GetDuration(handle));
        }
Ejemplo n.º 16
0
        public bool IsValid()
        {
            if (m_handle == Types.INVALID_HANDLE)
            {
                return(false);
            }

            return(HvrPlayerInterfaceAPI.Actor_IsValid(m_handle));
        }
Ejemplo n.º 17
0
        public void SetShaderSubroutinesArray(string[] code)
        {
            if (handle == HVR.Interface.Types.INVALID_HANDLE)
            {
                return;
            }

            HvrPlayerInterfaceAPI.RenderMethod_SetShaderSubroutinesArray(handle, code, code.Length);
        }
Ejemplo n.º 18
0
        public void SetAsset(int _assethandle)
        {
            if (m_handle == Types.INVALID_HANDLE)
            {
                return;
            }

            HvrPlayerInterfaceAPI.Actor_SetAsset(m_handle, _assethandle);
        }
        public int GetVoxelCount()
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return(0);
            }

            return(HvrPlayerInterfaceAPI.Asset_GetVoxelCount(handle));
        }
Ejemplo n.º 20
0
        public void SetProjMatrix(Matrix4x4 proj)
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return;
            }

            var apiMat44 = HvrPlayerInterfaceHelper.GetMat44FromMatrix4x4(proj);

            HvrPlayerInterfaceAPI.Viewport_SetProjMatrix(handle, apiMat44);
        }
        public void SetLooping(bool looping)
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return;
            }

            m_isLooping = looping;

            HvrPlayerInterfaceAPI.Asset_SetLooping(handle, looping);
        }
Ejemplo n.º 22
0
        public static bool IsInitialized()
        {
            if (!HvrHelper.Support.IsApplicationStateSupported())
            {
                return(false);
            }

            bool initialized = HvrPlayerInterfaceAPI.Interface_IsInitialised();

            return(initialized);
        }
Ejemplo n.º 23
0
        public bool IsValid()
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return(false);
            }

            bool valid = HvrPlayerInterfaceAPI.Viewport_IsValid(handle);

            return(valid);
        }
Ejemplo n.º 24
0
        public static string RenderMethod_GetTypeAtIndex(int idx)
        {
            StringBuilder stringBuilder = new StringBuilder(256);

            if (HvrPlayerInterfaceAPI.Interface_GetRenderMethodType(idx, stringBuilder, stringBuilder.Capacity))
            {
                return(stringBuilder.ToString());
            }

            return("");
        }
Ejemplo n.º 25
0
        public void SetSubroutineUniformTexture2D(string uniformName, Texture texture)
        {
            if (m_handle == HVR.Interface.Types.INVALID_HANDLE)
            {
                return;
            }

            IntPtr nativePtr = texture.GetNativeTexturePtr();

            HvrPlayerInterfaceAPI.Actor_SetSubroutineUniformTexture2D(handle, uniformName, HvrScene.ScenePlayerHandle(), nativePtr);
        }
Ejemplo n.º 26
0
        public void SetSubroutineUniformVec2(string uniformName, Vector2 value)
        {
            if (m_handle == HVR.Interface.Types.INVALID_HANDLE)
            {
                return;
            }

            CommonTypes.Vec2 vec2 = new CommonTypes.Vec2 {
                x = value.x, y = value.y
            };

            HvrPlayerInterfaceAPI.Actor_SetSubroutineUniformVec2(handle, uniformName, ref vec2);
        }
Ejemplo n.º 27
0
        private void Create()
        {
            if (!HvrHelper.Support.IsApplicationStateSupported())
            {
                return;
            }

            try
            {
                UnityInterface.Lock();

                if (HvrPlayerInterface.Initialise())
                {
                    m_handle = HvrPlayerInterfaceAPI.Viewport_Create();

#if VERBOSE_LOGGING
                    Debug.Log("Create " + GetType().Name + " Handle:" + handle);
#endif

                    UnityInterface.SceneObjectsAdd(handle, GetType().Name + handle, GetType().FullName);

#if UNITY_5_5_OR_NEWER
                    // No C# macro for reversed depth configuration. The only reference is: https://docs.unity3d.com/Manual/SL-PlatformDifferences.html
                    if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11 ||
                        SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12 ||
                        SystemInfo.graphicsDeviceType == GraphicsDeviceType.PlayStation4 ||
                        SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOne ||
                        SystemInfo.graphicsDeviceType == GraphicsDeviceType.Metal)
                    {
                        SetReverseDepthEnabled(true);
                    }
                    else
                    {
                        SetReverseDepthEnabled(false);
                    }
#else
                    SetReverseDepthEnabled(false);
#endif

                    SetColorSpace(QualitySettings.activeColorSpace);
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e.Message);
            }
            finally
            {
                UnityInterface.Unlock();
            }
        }
        public void Pause()
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return;
            }

            HvrPlayerInterfaceAPI.Asset_Pause(handle);

            if (onPause != null)
            {
                onPause();
            }
        }
        public void Step(int frames)
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return;
            }

            HvrPlayerInterfaceAPI.Asset_Step(handle, frames);

            if (onStop != null)
            {
                onStop();
            }
        }
        public void Stop()
        {
            if (handle == Types.INVALID_HANDLE)
            {
                return;
            }

            HvrPlayerInterfaceAPI.Asset_Pause(handle);
            HvrPlayerInterfaceAPI.Asset_Seek(handle, 0);

            if (onStop != null)
            {
                onStop();
            }
        }