private IEnumerator PrepareLightfieldRoutine(int index)
 {
     Debug.Log("Preparing lightfield");
     FluencePlugin.PrepareLightfieldPublic(index);
     while (!FluencePlugin.IsLightfieldReadyPublic(index))
     {
         yield return(0);
     }
     Debug.Log("Lightfield ready!");
 }
Пример #2
0
    private void Awake()
    {
        Instance = this;
        _cameras = FindObjectsOfType <Camera>();
        for (int i = 0; i < _cameras.Length; i++)
        {
            FluenceCamera fluenceCamera = _cameras[i].gameObject.AddComponent <FluenceCamera>();
            fluenceCamera.CameraIndex = i;
        }

        try
        {
            SetupPlugin();
        }
        catch (DllNotFoundException e)
        {
            Debug.LogError("fluence_plugin.dll is missing! Read the README!");
            Debug.Break();
            throw;
        }
        SetEyeCount(_cameras.Length);
        _eyeFromStartMatrixRaw        = new float[16];
        _clipFromEyeMatrixRaw         = new float[16];
        _startFromLightfieldMatrixRaw = new float[16];
        _viewportRaw      = new int[4];
        _flipMatrix       = Matrix4x4.identity;
        _flipMatrix[2, 2] = -1f;

        foreach (FluenceLightfield fluenceLightfield in Lightfields)
        {
            string text = Path.Combine(Application.streamingAssetsPath, fluenceLightfield.LightfieldPath);
            if (File.Exists(text))
            {
                fluenceLightfield.LightfieldIndex = LoadLightfield(text);
            }
            else
            {
                Debug.LogError("Could not find file: " + text + ". Have you imported .lf files into the StreamingAssets folder?");
                fluenceLightfield.LightfieldIndex = -1;
            }
        }
        Init();
        GL.IssuePluginEvent(GetRenderEventFunc(), 1179406079);
    }