public static string GetProviderCompilerFlag(IEyeTrackingProvider provider)
        {
            var attribute = Attribute.GetCustomAttribute(provider.GetType(), typeof(CompilerFlagAttribute)) as CompilerFlagAttribute;

            if (attribute == null)
            {
                return(null);
            }

            return(attribute.Flag);
        }
        public static bool Start(TobiiXR_Settings settings = null)
        {
            if (!TobiiEulaFile.IsEulaAccepted())
            {
                Debug.LogError("You need to accept Tobii Software Development License Agreement to be able to use Tobii XR Unity SDK.");
                return(false);
            }

            if (_eyeTrackingProvider != null)
            {
                Debug.LogWarning(string.Format("TobiiXR already started with provider ({0})", _eyeTrackingProvider));
                VerifyInstanceIntegrity();
                return(false);
            }

            if (settings == null)
            {
                settings = TobiiXR_Settings.CreateDefaultSettings();
            }

            if (settings.FieldOfUse == FieldOfUse.NotSelected)
            {
                //For more info, see https://developer.tobii.com/vr/develop/unity/documentation/configure-tobii-xr/
                Debug.LogError("Field of use has not been selected. Please specify intended field of use in TobiiXR_Settings (can also be edited in Window->Tobii->Tobii Settings)");
            }

            _eyeTrackingProvider = settings.EyeTrackingProvider;

            if (_eyeTrackingProvider == null)
            {
                _eyeTrackingProvider = new NoseDirectionProvider();
                Debug.LogWarning(string.Format("Creating ({0}) failed. Using ({1}) as fallback", settings.GetProviderType(), _eyeTrackingProvider.GetType().Name));
            }

            Debug.Log(string.Format("Starting TobiiXR with ({0}) as provider for eye tracking", _eyeTrackingProvider));

            Internal.G2OM = settings.G2OM;

            VerifyInstanceIntegrity();

            return(true);
        }
Beispiel #3
0
        public static bool Start(TobiiXR_Settings settings = null)
        {
            if (_eyeTrackingProvider != null)
            {
                Debug.LogWarning(string.Format("TobiiXR already started with provider ({0})", _eyeTrackingProvider));
                VerifyInstanceIntegrity();
                return(false);
            }

            if (settings == null)
            {
                settings = TobiiXR_Settings.CreateDefaultSettings();
            }

            _eyeTrackingProvider = settings.EyeTrackingProvider;

            if (_eyeTrackingProvider == null)
            {
                _eyeTrackingProvider = new NoseDirectionProvider();
                Debug.LogWarning(string.Format("Creating ({0}) failed. Using ({1}) as fallback", settings.GetProviderType(), _eyeTrackingProvider.GetType().Name));
            }

            Debug.Log(string.Format("Starting TobiiXR with ({0}) as provider for eye tracking", _eyeTrackingProvider));

            _g2om = settings.G2OM;

            VerifyInstanceIntegrity();

            return(true);
        }