Example #1
0
        public void Connect(string pURL, string pApplicationName, string pUsername, string pPassword)
        {
            vdkError error = vdkContext_Connect(ref pContext, pURL, pApplicationName, pUsername, pPassword);

            if (error != vdkError.vE_Success)
            {
                error = vdkContext.vdkContext_TryResume(ref pContext, pURL, pApplicationName, pUsername, true);
            }
            if (error == Vault.vdkError.vE_ConnectionFailure)
            {
                throw new Exception("Could not connect to server.");
            }
            else if (error == Vault.vdkError.vE_AuthFailure)
            {
                throw new Exception("Username or Password incorrect.");
            }
            else if (error == Vault.vdkError.vE_OutOfSync)
            {
                throw new Exception("Your clock doesn't match the remote server clock.");
            }
            else if (error == Vault.vdkError.vE_SecurityFailure)
            {
                throw new Exception("Could not open a secure channel to the server.");
            }
            else if (error == Vault.vdkError.vE_ServerFailure)
            {
                throw new Exception("Unable to negotiate with server, please confirm the server address");
            }
            else if (error != Vault.vdkError.vE_Success)
            {
                throw new Exception("Unknown error occurred: " + error.ToString() + ", please try again later.");
            }
        }
Example #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());
            }
        }
Example #3
0
        public void RenewLicense(LicenseType type)
        {
            vdkError error = vdkContext_RenewLicense(pContext, type);

            if (error != Vault.vdkError.vE_Success)
            {
                throw new Exception("VDK License Error: " + error.ToString());
            }
        }
Example #4
0
        public void Try_Resume(string pURL, string pApplicationName, string pUsername, bool tryDongle)
        {
            vdkError error = vdkContext_TryResume(ref pContext, pURL, pApplicationName, pUsername, tryDongle);

            if (error != vdkError.vE_Success)
            {
                throw new Exception("Unable to keep session alive: " + error.ToString());
            }
        }
Example #5
0
        public void KeepAlive()
        {
            vdkError error = vdkContext_KeepAlive(pContext);

            if (error != vdkError.vE_Success)
            {
                throw new Exception("Unable to keep session alive: " + error.ToString());
            }
        }
Example #6
0
        public void Load(vdkContext context, string modelLocation, ref vdkPointCloudHeader header)
        {
            vdkError error = vdkPointCloud_Load(context.pContext, ref pModel, modelLocation, ref header);

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

            this.context = context;
        }
Example #7
0
        public void SetMatrix(RenderViewMatrix matrixType, double[] cameraMatrix)
        {
            if (pRenderView == IntPtr.Zero)
            {
                throw new Exception("view not instantiated");
            }

            vdkError error = vdkRenderView_SetMatrix(pRenderView, matrixType, cameraMatrix);

            if (error != Vault.vdkError.vE_Success)
            {
                throw new Exception("vdkRenderView.SetMatrix failed: " + error.ToString());
            }
        }
Example #8
0
        public void Destroy()
        {
            if (pRenderer == IntPtr.Zero)
            {
                return;
            }
            vdkError error = vdkRenderContext_Destroy(ref pRenderer);

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

            pRenderer = IntPtr.Zero;
        }
Example #9
0
        public void Create(vdkContext context, vdkRenderContext renderer, UInt32 width, UInt32 height)
        {
            if (context.pContext == IntPtr.Zero)
            {
                throw new Exception("context not instantiated");
            }

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

            vdkError error = vdkRenderView_Create(context.pContext, ref pRenderView, renderer.pRenderer, width, height);

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

            this.context = context;
        }
Example #10
0
        public void Create(vdkContext context)
        {
            //ensure we destroy the existing context if we are creating a new one:
            if (pRenderer != IntPtr.Zero)
            {
                Destroy();
            }

            if (context.pContext == IntPtr.Zero)
            {
                throw new Exception("context not instantiatiated");
            }

            vdkError error = vdkRenderContext_Create(context.pContext, ref pRenderer);

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

            this.context = context;
        }