Beispiel #1
0
    private bool UpdateTexture()
    {
        bool result = false;

        AVProWindowsMediaManager.ConversionMethod method = AVProWindowsMediaManager.Instance.TextureConversionMethod;

//#if UNITY_4_3 || UNITY_4_2 || UNITY_4_1 || UNITY_4_0_1 || UNITY_4_0 || UNITY_3_5
#if !UNITY_3_4 && !UNITY_3_3 && !UNITY_3_2 && !UNITY_3_1 && !UNITY_3_0
        if (method == AVProWindowsMediaManager.ConversionMethod.Unity4 ||
            method == AVProWindowsMediaManager.ConversionMethod.Unity35_OpenGL)
        {
            // We update all the textures from AVProQuickTimeManager.Update()
            // so just check if the update was done
            int lastFrameUploaded = AVProWindowsMediaPlugin.GetLastFrameUploaded(_movieHandle);
            if (_lastFrameUploaded != lastFrameUploaded)
            {
                _lastFrameUploaded = lastFrameUploaded;
                result             = true;
            }
            return(result);
        }
#endif

#if UNITY_3_4
        // Update the OpenGL texture directly
        if (method == AVProWindowsMediaManager.ConversionMethod.Unity34_OpenGL)
        {
            result = AVProWindowsMediaPlugin.UpdateTextureGL(_movieHandle, _rawTexture.GetNativeTextureID(), ref _lastFrameUploaded);
            GL.InvalidateState();
        }
#endif

//#if !UNITY_4_3 && !UNITY_4_2 && !UNITY_4_1 && !UNITY_4_0_1 && !UNITY_4_0
#if UNITY_3_5 || UNITY_3_4 || UNITY_3_3 || UNITY_3_2 || UNITY_3_1 || UNITY_3_0
        // Update the texture using Unity scripting, this is the slowest method
        if (method == AVProWindowsMediaManager.ConversionMethod.UnityScript)
        {
            result = AVProWindowsMediaPlugin.GetFramePixels(_movieHandle, _frameHandle.AddrOfPinnedObject(), _rawTexture.width, _rawTexture.height, ref _lastFrameUploaded);
            if (result)
            {
                _rawTexture.SetPixels32(_frameData);
                _rawTexture.Apply(false, false);
            }
        }
#endif

        return(result);
    }
    private bool UpdateTexture()
    {
        bool result = false;

        // We update all the textures from AVProQuickTimeManager.Update()
        // so just check if the update was done
        int lastFrameUploaded = AVProWindowsMediaPlugin.GetLastFrameUploaded(_movieHandle);

        if (_lastFrameUploaded != lastFrameUploaded)
        {
            _lastFrameUploaded = lastFrameUploaded;
            result             = true;
        }

        return(result);
    }