public void OnEnable() { pluginInfo.Add(new string[] { "Version: ", VersionInfo.VERSION }); pluginInfo.Add(new string[] { "Build Date: ", VersionInfo.BUILD_DATE }); pluginInfo.Add(new string[] { "Hash: ", VersionInfo.GIT_HASH }); if (HvrPlayerInterface.Initialise()) { hvrEngineInfo.Add(new string[] { "Version: ", HvrPlayerInterface.GetInfo("VERSION") }); hvrEngineInfo.Add(new string[] { "Build Date: ", HvrPlayerInterface.GetInfo("BUILD_DATE") }); hvrEngineInfo.Add(new string[] { "Hash: ", HvrPlayerInterface.GetInfo("GIT_HASH") }); } about_info = "8i Unity Plugin:"; for (int i = 0; i < pluginInfo.Count; i++) { about_info += "\n"; about_info += pluginInfo[i][0] + pluginInfo[i][1]; } about_info += "\n"; about_info += "\n"; about_info += "HVR Engine:"; for (int i = 0; i < hvrEngineInfo.Count; i++) { about_info += "\n"; about_info += hvrEngineInfo[i][0] + hvrEngineInfo[i][1]; } EditorApplication.update -= Repaint; EditorApplication.update += Repaint; }
public static void Player_RenderActor(int actor, int viewport, GetRenderTextureNativePtr getColorTarget, GetRenderTextureNativePtr getDepthTarget) { if (!HvrPlayerInterface.IsInitialized()) { return; } bool sRGBWrite = GL.sRGBWrite; int player = ScenePlayerHandle(); if (getColorTarget == null) { getColorTarget = ReturnZeroPointer; } if (getDepthTarget == null) { getDepthTarget = ReturnZeroPointer; } int eventID = UnityInterfaceAPI.QueueGLEventPrepFrameContextIII(HvrPlayerInterfaceAPI.Player_Render, player, actor, viewport, getColorTarget(), getDepthTarget()); GL.IssuePluginEvent(UnityInterfaceAPI.UnityRenderEventFunc(), eventID); GL.InvalidateState(); // TODO: Reset this as a deferred step. GL.sRGBWrite = sRGBWrite; }
public static void Player_WillRender(int actor, int viewport) { if (!HvrPlayerInterface.IsInitialized()) { return; } int player = ScenePlayerHandle(); int eventID = UnityInterfaceAPI.QueueGLEventIII(HvrPlayerInterfaceAPI.Player_WillRender, player, actor, viewport); GL.IssuePluginEvent(UnityInterfaceAPI.UnityRenderEventFunc(), eventID); GL.InvalidateState(); }
static void UpdateHvrInfo() { m_info["HVR_VersionInfo_VERSION"] = VersionInfo.VERSION; m_info["HVR_VersionInfo_GIT_HASH"] = VersionInfo.GIT_HASH; m_info["HVR_VersionInfo_GIT_BRANCH"] = VersionInfo.GIT_BRANCH; m_info["HVR_VersionInfo_BUILD_DATE"] = VersionInfo.BUILD_DATE; if (HvrPlayerInterface.Initialise()) { m_info["HvrPlayerInterface_VERSION"] = HvrPlayerInterface.GetInfo(HvrPlayerInterfaceAPI.Player_GetInfo_Keys.VERSION); m_info["HvrPlayerInterface_BUILD_DATE"] = HvrPlayerInterface.GetInfo(HvrPlayerInterfaceAPI.Player_GetInfo_Keys.BUILD_DATE); m_info["HvrPlayerInterface_GIT_HASH"] = HvrPlayerInterface.GetInfo(HvrPlayerInterfaceAPI.Player_GetInfo_Keys.GIT_HASH); } }
static AnalyticsManager() { if (UnityEditorInternal.InternalEditorUtility.inBatchMode) { return; } if (GetOptOut() == true) { return; } // Developer version, do not log if (HVR.VersionInfo.VERSION == "-1") { return; } // If the current process id is the same as last time, don't log any events // This suppresses analytics being sent after every code recompilation int currentID = System.Diagnostics.Process.GetCurrentProcess().Id; if (GetSessionID() == currentID) { return; } SetSessionID(currentID); LogEvent("AUTO", "INIT", "INIT", 0); LogEvent("INFO", "HVR_VERSION", HVR.VersionInfo.VERSION, 0); LogEvent("INFO", "HVR_GIT_INFO", HVR.VersionInfo.GIT_INFO, 0); if (HvrPlayerInterface.Initialise()) { LogEvent("INFO", "HVR_PLAYERINTERFACE_GIT_VERSION", HvrPlayerInterface.GetInfo(HvrPlayerInterfaceAPI.Player_GetInfo_Keys.VERSION), 0); LogEvent("INFO", "HVR_PLAYERINTERFACE_GIT_INFO", HvrPlayerInterface.GetInfo(HvrPlayerInterfaceAPI.Player_GetInfo_Keys.GIT_INFO), 0); } LogEvent("INFO", "APPLICATION_UNITY_VERSION", Application.unityVersion, 0); LogEvent("INFO", "APPLICATION_PLATFORM", Application.platform.ToString(), 0); LogEvent("INFO", "SYSTEMINFO_OPERATINGSYSTEM", SystemInfo.operatingSystem, 0); LogEvent("INFO", "SYSTEMINFO_PROCESSORTYPE", SystemInfo.processorType, 0); LogEvent("INFO", "SYSTEMINFO_GRAPHICSDEVICENAME", SystemInfo.graphicsDeviceName.ToString(), 0); LogEvent("INFO", "SYSTEMINFO_GRAPHICSDEVICETYPE", SystemInfo.graphicsDeviceType.ToString(), 0); }
private static void Update() { if (!EditorApplication.isPlaying || EditorApplication.isPaused) { // prevent memory keeps going up when in Unity Editor and the HvrActor is inactive HvrPlayerInterface.Update(); } List <HvrActor> actors = new List <HvrActor>(); HvrScene.GetObjects(actors); foreach (HvrActor actor in actors) { actor.EditorUpdate(); } }
private void Update() { #if UNITY_EDITOR // Block this function from running if this object is a prefab if (PrefabUtility.GetPrefabType(this) == PrefabType.Prefab) { return; } #endif if (m_assetInterface != null) { m_assetInterface.Update(Helper.GetCurrentTime()); if (m_assetInterface.assetSource == AssetInterface.AssetSource.VOD || m_assetInterface.assetSource == AssetInterface.AssetSource.RealTime) { if (m_assetInterface.IsOffline()) { HvrPlayerInterface.CheckConnection(); } } } bool subroutineStackUpdated = m_subroutineStack.Update(GetComponents <HvrActorShaderSubroutineBase>()); if (m_forceUpdateSubroutines || subroutineStackUpdated) { m_forceUpdateSubroutines = false; string[] shaders = m_subroutineStack.GetShaderArray(); if (m_renderMethodInterface != null) { m_renderMethodInterface.SetShaderSubroutinesArray(shaders); } } }
public static void Player_PrepareRender(GetRenderTextureNativePtr getColorTarget, GetRenderTextureNativePtr getDepthTarget) { if (!HvrPlayerInterface.IsInitialized()) { return; } // Only allow PrepareRender to be called if the frame has changed // This handles an issue with Metal where a internal buffer index needs to be bumped each PrepareRender // // A potential issue for this is that lodding step within PrepareRender will not take into account any viewport changes // that occur within this frame, after PrepareRender is called. if (Time.frameCount != lastPreparedFrame) { lastPreparedFrame = Time.frameCount; HvrPlayerInterface.Update(); WillRender(); int player = ScenePlayerHandle(); if (getColorTarget == null) { getColorTarget = ReturnZeroPointer; } if (getDepthTarget == null) { getDepthTarget = ReturnZeroPointer; } int eventID = UnityInterfaceAPI.QueueGLEventPrepFrameContextI(HvrPlayerInterfaceAPI.Player_PrepareRender, player, getColorTarget(), getDepthTarget()); GL.IssuePluginEvent(UnityInterfaceAPI.UnityRenderEventFunc(), eventID); GL.InvalidateState(); } }
private void DrawAboutSection() { Rect links = EditorGUILayout.GetControlRect(); GUI.Box(new Rect(links.x - 4, links.y, links.width + 8, links.height), "Links", EditorStyles.toolbarButton); GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); // Website if (GUILayout.Button("8i.com", GUILayout.Height(32), GUILayout.Width(100))) { Application.OpenURL("http://8i.com"); } // Website if (GUILayout.Button("Documentation", GUILayout.Height(32), GUILayout.Width(100))) { Application.OpenURL("https://8i.com/unity/docs/index.html"); } // Website if (GUILayout.Button("Support", GUILayout.Height(32), GUILayout.Width(100))) { Application.OpenURL("https://8isupport.zendesk.com"); } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); Rect baseRect = EditorGUILayout.GetControlRect(); GUI.Box(new Rect(baseRect.x - 4, baseRect.y, baseRect.width + 8, baseRect.height), "Version Info", EditorStyles.toolbarButton); if (GUI.Button(new Rect(baseRect.xMax - 120, baseRect.y, 120, baseRect.height), "Copy To Clipboard", EditorStyles.miniButton)) { EditorGUIUtility.systemCopyBuffer = about_info; } GUILayout.BeginVertical("box"); { EditorGUILayout.TextArea(about_info, EditorStyles.largeLabel); } GUILayout.EndVertical(); Rect memoryRect = EditorGUILayout.GetControlRect(); GUI.Box(new Rect(memoryRect.x - 4, memoryRect.y, memoryRect.width + 8, memoryRect.height), "Memory Statistics", EditorStyles.toolbarButton); if (HvrPlayerInterface.Initialise()) { GUILayout.BeginHorizontal(); { CommonTypes.MemoryStats memoryStats = Interface.HvrPlayerInterfaceAPI.Interface_GetMemoryStats(); GUILayout.BeginVertical("box"); { string stats = string.Empty; stats += "allocBytes\n"; stats += "allocBlocks\n"; stats += "freeBytes\n"; stats += "freeBlocks\n"; stats += "usedBytes\n"; stats += "usedBlocks"; EditorGUILayout.TextArea(stats, EditorStyles.largeLabel); } GUILayout.EndVertical(); GUILayout.BeginVertical("box"); { string stats = string.Empty; stats += memoryStats.allocBytes + "\n"; stats += memoryStats.allocBlocks + "\n"; stats += memoryStats.freeBytes + "\n"; stats += memoryStats.freeBlocks + "\n"; stats += memoryStats.usedBytes + "\n"; stats += memoryStats.usedBlocks; EditorGUILayout.TextArea(stats, EditorStyles.largeLabel); } GUILayout.EndVertical(); } GUILayout.EndHorizontal(); } Rect settingsRect = EditorGUILayout.GetControlRect(); GUI.Box(new Rect(settingsRect.x - 4, settingsRect.y, settingsRect.width + 8, settingsRect.height), "Settings", EditorStyles.toolbarButton); bool analyticsOptOut = HVR.Editor.Analytics.AnalyticsManager.GetOptOut(); analyticsOptOut = EditorGUILayout.Toggle("Opt-out of Analytics", analyticsOptOut); HVR.Editor.Analytics.AnalyticsManager.SetOptOut(analyticsOptOut); }
private void Init() { #if UNITY_EDITOR // In the case that this component is a prefab, // don't allow interface objects to be created if (PrefabUtility.GetPrefabType(this) == PrefabType.Prefab) { return; } // There are issues with releasing unmanaged memory while running in batch mode for OSX and iOS // TODO: Remove this check if (UnityEditorInternal.InternalEditorUtility.inBatchMode) { return; } #endif m_actorInterface = new ActorInterface(); m_actorInterface.Create(); if (m_renderMethodInterface == null) { if (string.IsNullOrEmpty(m_renderMethodType)) { m_renderMethodType = HvrPlayerInterface.RenderMethod_GetDefaultMethodType(); } // Create this HvrActor's rendermethod // !! Always create the rendermethod before creating the asset as // !! there is a work around in SetRenderMethodInterface which requires // !! the asset to be recreated if the rendermethod changes CreateRenderMethod(m_renderMethodType); } if (m_assetInterface == null) { // Create the asset if (string.IsNullOrEmpty(data) == false) { CreateAsset(data, dataMode); } } if (m_assetInterface != null) { m_assetInterface.Seek(assetSeekTime); m_assetInterface.SetLooping(assetLoop); // Only allow assets to be played or seek when the application is playing if (Application.isPlaying) { if (assetPlay) { m_assetInterface.Play(); } } } #if UNITY_EDITOR // Handle case where HvrActor is duplicated within the Unity Editor // We need to ensure that the HvrActor has a unique material if (m_instanceID == 0) { m_instanceID = GetInstanceID(); } else if (m_instanceID != GetInstanceID() && GetInstanceID() < 0) { m_instanceID = GetInstanceID(); if (m_material != null) { Material mat = new Material(m_material.shader); mat.name = m_material.name; mat.CopyPropertiesFromMaterial(m_material); mat.shaderKeywords = m_material.shaderKeywords; m_material = mat; } } #endif m_renderMesh = new Mesh(); m_subroutineStack = new HvrActorShaderSubroutineStack(); HvrScene.Add(this); }