PSEyeTexture.CLEyeGetCameraCount C# (CSharp) Method

CLEyeGetCameraCount() private method

private CLEyeGetCameraCount ( ) : int
return int
    public static extern int CLEyeGetCameraCount();

Usage Example

Esempio n. 1
0
    void Awake()
    {
        // Check PS Eye number
        try {
            int psEyeCount = PSEyeTexture.CLEyeGetCameraCount();
            switch (psEyeCount)
            {
            case 0:
                Debug.LogError("No PS Eye found");
                return;

            case 1:
                Debug.LogError("Only one PS Eye found");
                return;
            }
        } catch (Exception e) {
            Debug.LogError("Oops..., Failed at loading CLEyeMulticam.dll. Please relaunch Unity!");
            Debug.LogError(e.ToString());
            return;
        }

        // Make PS Eye texture
        var PsEyeTexture = new PSEyeTexture(PsEyeId, FrameRate, true);

        psEye_ = new NyARUnityPSEye(PsEyeTexture);

        // Marker system
        var config = new NyARMarkerSystemConfig(PsEyeTexture.Width, PsEyeTexture.Height);

        markerSystem_ = new NyARUnityMarkerSystem(config);

        // Load marker from texture
        var markerTexture = (Texture2D)(Resources.Load(MarkerName, typeof(Texture2D)));

        markerId_ = markerSystem_.addARMarker(markerTexture, 16, 25, 80);

        // Marker layer
        MarkerObject.layer = Layer;
        for (int i = 0; i < MarkerObject.transform.GetChildCount(); ++i)
        {
            MarkerObject.transform.GetChild(i).gameObject.layer = Layer;
        }

        // Set camera background
        Background.renderer.material.mainTexture = PsEyeTexture.Texture;
        Background.layer      = Layer;
        ARCamera.cullingMask &= ~(1 << HiddenLayer);
        markerSystem_.setARBackgroundTransform(Background.transform);
        markerSystem_.setARCameraProjection(ARCamera);
    }