コード例 #1
0
        public void Connect(string pURL, string pApplicationName, string pUsername, string pPassword)
        {
            udError error = udContext.udContext_TryResume(ref pContext, pURL, pApplicationName, pUsername, true);

            if (error != udError.udE_Success)
            {
                error = udContext_Connect(ref pContext, pURL, pApplicationName, pUsername, pPassword);
            }
            if (error == Vault.udError.udE_ConnectionFailure)
            {
                throw new Exception("Could not connect to server.");
            }
            else if (error == Vault.udError.udE_AuthFailure)
            {
                throw new Exception("Username or Password incorrect.");
            }
            else if (error == Vault.udError.udE_OutOfSync)
            {
                throw new Exception("Your clock doesn't match the remote server clock.");
            }
            else if (error == Vault.udError.udE_SecurityFailure)
            {
                throw new Exception("Could not open a secure channel to the server.");
            }
            else if (error == Vault.udError.udE_ServerFailure)
            {
                throw new Exception("Unable to negotiate with server, please confirm the server address");
            }
            else if (error != Vault.udError.udE_Success)
            {
                throw new Exception("Unknown error occurred: " + error.ToString() + ", please try again later.");
            }
        }
コード例 #2
0
        public void Render(udRenderTarget renderView, udRenderInstance[] pModels, int modelCount, RenderOptions options)
        {
            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");
            }

            udError error = udRenderContext_Render(pRenderer, renderView.pRenderView, pModels, modelCount, options.options);

            if (error != Vault.udError.udE_Success)
            {
                Debug.Log("vdkRenderContext.Render failed: " + error.ToString());
            }
            options.pickRendered = true;
        }
コード例 #3
0
        public void Try_Resume(string pURL, string pApplicationName, string pUsername, bool tryDongle)
        {
            udError error = udContext_TryResume(ref pContext, pURL, pApplicationName, pUsername, tryDongle);

            if (error != udError.udE_Success)
            {
                throw new Exception("Unable to keep session alive: " + error.ToString());
            }
        }
コード例 #4
0
ファイル: VaultQuery.cs プロジェクト: ConnerHua/vaultsdkunity
        /*
         * Set the vdkQueryFilter to find voxels within a cylinder.
         *
         * Note
         *
         *  When inverted, this filter will return all points outside the cylinder.
         * Parameters
         *
         * pQueryFilter: The vdkQueryFilter to configure.
         *
         * centrePoint: The world space {X,Y,Z} array for the center point of the cylinder.
         *
         * radius: The radius of the cylinder (the world space axis are defined by yawPitchRoll) the circle exists in local axis XY extruded along Z.
         *
         * halfHeight: The half-height of the cylinder (the world space axis are defined by yawPitchRoll) the circle exists in local axis XY extruded along Z.
         *
         * yawPitchRoll: The rotation of the cylinder (in radians). Applied in YPR order.
         *
         */
        public void SetAsCylinder(double[] centrePoint, double radius, double halfHeight, double[] yawPitchRoll)
        {
            udError error = vdkQueryFilter_SetAsCylinder(pQueryFilter, centrePoint, radius, halfHeight, yawPitchRoll);

            if (error != udError.udE_Success)
            {
                throw new Exception("Query SetAsCylinder Failed: " + error.ToString());
            }
        }
コード例 #5
0
ファイル: VaultQuery.cs プロジェクト: ConnerHua/vaultsdkunity
        public vdkQueryFilter()
        {
            udError error = vdkQueryFilter_Create(ref pQueryFilter);

            if (error != udError.udE_Success)
            {
                throw new Exception("Query Creation Failed: " + error.ToString());
            }
        }
コード例 #6
0
ファイル: VaultQuery.cs プロジェクト: ConnerHua/vaultsdkunity
        /*
         * Set the vdkQueryFilter to find voxels within a box.
         *
         * Note:
         *
         *  When inverted, this filter will return all points outside the box.
         *
         * Parameters:
         *
         * pQueryFilter: The vdkQueryFilter to configure.
         *
         * centrePoint: The world space {X,Y,Z} array for the center point.
         *
         * halfSize: The local space {X,Y,Z} half size of the box (the world space axis are defined by yawPitchRoll).
         *
         * yawPitchRoll: The rotation of the model (in radians). Applied in YPR order.
         *
         */
        public void SetAsBox(double[] centrePoint, double[] halfSize, double[] yawPitchRoll)
        {
            udError error = vdkQueryFilter_SetAsBox(pQueryFilter, centrePoint, halfSize, yawPitchRoll);

            if (error != udError.udE_Success)
            {
                throw new Exception("Query SetAsBox Failed: " + error.ToString());
            }
        }
コード例 #7
0
ファイル: VaultQuery.cs プロジェクト: ConnerHua/vaultsdkunity
        /*
         * Invert the result of a vdkQueryFilter
         *
         * Parameters
         *
         * inverted: True if the filter should be inverted, False is it should behave as default.
         *
         */
        public void SetInverted(bool inverted)
        {
            udError error = vdkQueryFilter_SetInverted(pQueryFilter, inverted);

            if (error != udError.udE_Success)
            {
                throw new Exception("Query Inversion Failed: " + error.ToString());
            }
        }
コード例 #8
0
ファイル: VaultQuery.cs プロジェクト: ConnerHua/vaultsdkunity
        /*
         * Set the vdkQueryFilter to find voxels within a sphere.
         *
         *
         * Note:
         *
         *  When inverted, this filter will return all points outside the sphere.
         *
         * Parameters:
         *
         * pQueryFilter: The vdkQueryFilter to configure.
         *
         * centrePoint: The world space {X,Y,Z} array for the center point.
         *
         * radius: The radius from the centerPoint to the edge of the sphere.
         *
         */
        public void SetAsSphere(double[] centrePoint, double radius)
        {
            udError error = vdkQueryFilter_SetAsSphere(pQueryFilter, centrePoint, radius);

            if (error != udError.udE_Success)
            {
                throw new Exception("Query SetAsSphere Failed: " + error.ToString());
            }
        }
コード例 #9
0
        public void Load(udContext context, string modelLocation, ref udPointCloudHeader header)
        {
            udError error = udPointCloud_Load(context.pContext, ref pModel, modelLocation, ref header);

            if (error != Vault.udError.udE_Success)
            {
                throw new Exception("udPointCloud.Load failed: " + error.ToString());
            }

            this.context = context;
        }
コード例 #10
0
        public UDProject(string geoJSON)
        {
            udError err = udProject_LoadFromMemory(ref pudProject, geoJSON);

            if (err != udError.udE_Success)
            {
                throw new Exception("project load failed: " + err.ToString());
            }

            pRootNode = IntPtr.Zero;
            udProject_GetProjectRoot(pudProject, ref pRootNode);
        }
コード例 #11
0
        public void SetMatrix(udRenderTargetMatrix matrixType, double[] cameraMatrix)
        {
            if (pRenderView == IntPtr.Zero)
            {
                throw new Exception("view not instantiated");
            }

            udError error = udRenderTarget_SetMatrix(pRenderView, matrixType, cameraMatrix);

            if (error != Vault.udError.udE_Success)
            {
                throw new Exception("vdkRenderView.SetMatrix failed: " + error.ToString());
            }
        }
コード例 #12
0
        public void Destroy()
        {
            if (pRenderer == IntPtr.Zero)
            {
                return;
            }
            udError error = udRenderContext_Destroy(ref pRenderer);

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

            pRenderer = IntPtr.Zero;
        }
コード例 #13
0
        public void Create(udContext context, udRenderContext 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");
            }

            udError error = udRenderTarget_Create(context.pContext, ref pRenderView, renderer.pRenderer, width, height);

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

            this.context = context;
        }
コード例 #14
0
        public void Create(udContext 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");
            }

            udError error = udRenderContext_Create(context.pContext, ref pRenderer);

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

            this.context = context;
        }