예제 #1
0
        public static void Login()
        {
            // Using editor prefs unfortunatly
            vaultUsername = EditorPrefs.GetString(SavedUsernameKey);
            vaultPassword = EditorPrefs.GetString(SavedPasswordKey);

            if (!GlobalVDKContext.isCreated)
            {
                try
                {
                    Debug.Log("Attempting to resume Euclideon Vault session");
                    vContext.Try_Resume(vaultServer, "Unity", vaultUsername, true);
                    vContext.RequestLicense(LicenseType.Render);
                    isCreated = true;
                    Debug.Log("Resume Succeeded");
                }
                catch (System.Exception e)
                {
                    Debug.Log(e.ToString() + "Logging in to Euclideon Vault server");
                    GlobalVDKContext.vContext.Connect(vaultServer, "Unity", vaultUsername, vaultPassword);
                    vContext.RequestLicense(LicenseType.Render);
                    GlobalVDKContext.isCreated = true;
                    Debug.Log("Logged in!");
                }
            }
            renderer.Create(vContext);
        }
예제 #2
0
        public void Render(vdkRenderView renderView, vdkRenderInstance[] pModels, int modelCount)
        {
            if (modelCount == 0)
            {
                return;
            }

            if (renderView == null)
            {
                throw new Exception("renderView is null");
            }

            if (renderView.pRenderView == IntPtr.Zero)
            {
                throw new Exception("RenderView not initialised");
            }

            if (pRenderer == IntPtr.Zero)
            {
                throw new Exception("renderContext not initialised");
            }

            vdkError error = vdkRenderContext_Render(pRenderer, renderView.pRenderView, pModels, modelCount, (IntPtr.Zero));

            if (error == vdkError.vE_InvalidLicense)
            {
                context.RequestLicense(LicenseType.Render);
                error = vdkRenderContext_Render(pRenderer, renderView.pRenderView, pModels, modelCount, (IntPtr)0);
            }

            if (error != Vault.vdkError.vE_Success)
            {
                throw new Exception("vdkRenderContext.Render failed: " + error.ToString());
            }
        }