コード例 #1
0
    /// <summary>
    /// Enable the spatial mapping
    /// </summary>
    /// <param name="resolutionPreset"> A preset resolution</param>
    /// <param name="rangePreset">A preset range</param>
    /// <param name="isTextured">if true, images will be collected during the process</param>
    /// <returns></returns>
    private sl.ERROR_CODE EnableSpatialMapping(RESOLUTION resolutionPreset, RANGE rangePreset, bool isTextured)
    {
        sl.ERROR_CODE error;
        this.isTextured            = isTextured;
        error                      = zedSpatialMapping.EnableSpatialMapping(ZEDSpatialMappingHelper.ConvertResolutionPreset(resolutionPreset), ZEDSpatialMappingHelper.ConvertRangePreset(rangePreset), isTextured);
        ZEDMeshRenderer.isTextured = false;
        stopWanted                 = false;
        running                    = true;

        if (error == sl.ERROR_CODE.SUCCESS)
        {
            display                 = true;
            meshUpdated             = false;
            spatialMappingRequested = false;
            updateTexture           = false;
            updatedTexture          = false;

            // clear all prevous meshes
            ClearMeshes();

            //start the requesting meshes
            zedCamera.RequestMesh();

            //Launch the thread to retrieve the chunks and their sizes
            scanningThread      = new Thread(UpdateMesh);
            updateThreadRunning = true;
            if (OnMeshStarted != null)
            {
                OnMeshStarted();
            }
            scanningThread.Start();
        }
        return(error);
    }
コード例 #2
0
    public ZEDSpatialMapping(Transform transform, sl.ZEDCamera zedCamera, ZEDManager zedManager)
    {
        zedSpatialMapping = new ZEDSpatialMappingHelper(Resources.Load("Materials/SpatialMapping/Mat_ZED_Texture") as Material, Resources.Load("Materials/SpatialMapping/Mat_ZED_Geometry_Wireframe") as Material);

        this.zedCamera    = zedCamera;
        this.zedManager   = zedManager;
        scanningInitState = sl.ERROR_CODE.FAILURE;

        holder      = new GameObject();
        holder.name = "[ZED Mesh Holder]";
        //holder.hideFlags = HideFlags.HideInInspector;
        holder.transform.position = Vector3.zero;
        holder.transform.rotation = Quaternion.identity;
        StaticBatchingUtility.Combine(holder);
    }