예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (updateScreenOrientation())
        {
            // also update size/orientation of metaio SDK and camera projection
            // matrix
            MetaioSDKUnity.resizeRenderer(Screen.width, Screen.height);
            MetaioSDKUnity.updateScreenOrientation(screenOrientation);
            metaioCamera.updateCameraProjectionMatrix();
        }

        // Try to create the texture (must call every frame in case required size changes)
        textureCreated = createTexture(0);

        if (textureCreated)
        {
            updateCameraPlaneScale();
        }

        // TODO: GL.IssuePluginEvent should be used on all platforms,
        // but in Unity 3.5.x, the callbacks in the native plugin are
        // never called. Check if they work in Unity 4.x.
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
        GL.IssuePluginEvent(textureID);
#elif UNITY_ANDROID || UNITY_IPHONE
        MetaioSDKUnity.UnityRenderEvent(textureID);
#endif
    }
예제 #2
0
    private IEnumerator CallPluginAtEndOfFrames()
    {
        while (true)
        {
            // Wait until all frame rendering is done
            yield return(new WaitForEndOfFrame());

            // Note that the following call triggers the tracking in the SDK, so you must not disable/remove *this* script!
#if UNITY_IPHONE
            MetaioSDKUnity.UnityRenderEvent(textureID);
#else
            GL.IssuePluginEvent(textureID);
#endif
        }
    }