Exemple #1
0
    // Use this for initialization
    void Awake()
    {
        if (!this.isActiveAndEnabled)
        {
            return;
        }

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
        this.gameObject.SetActive(false); //to prevent awake method to execute before its variable initialization

        spout = gameObject.AddComponent <SpoutCamSender>();

        spout.sharingName       = sharingName;
        spout.blackTex          = blackTex;
        spout.texture           = texture;
        spout.textureFormat     = textureFormat;
        spout.debugConsole      = debugConsole;
        spout.showTexture       = showTexture;
        spout.forceBlackTexture = forceBlackTexture;
#endif
#if UNITY_EDITOR_MAC || UNITY_STANDALONE_OSX
        this.gameObject.SetActive(false);
        funnel = gameObject.AddComponent <Funnel.Funnel>(); //to prevent awake method to execute before its variable initialization

        funnel.antiAliasing = antiAliasing;
        funnel.discardAlpha = discardAlpha;
        funnel.renderMode   = renderMode;
#endif
        this.gameObject.SetActive(true);
    }
 void Start()
 {
     _funnel = FindObjectOfType <Funnel.Funnel>();
     _w      = _funnel.screenWidth;
     _h      = _funnel.screenHeight;
     _tex    = new Texture2D(_w, _h);
 }
    // Use this for initialization
    void Awake()
    {
        //Get the shared texture camera on this object
        _myCam = GetComponent <Camera>();

        if (!this.isActiveAndEnabled)
        {
            return;
        }

#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
        this.gameObject.SetActive(false); //to prevent awake method to execute before its variable initialization

        spout = gameObject.AddComponent <Klak.Spout.SpoutSender>();

        spout.useCamera     = false;
        spout.sourceTexture = texture;
        spout.senderName    = sharingName;
        spout.alphaSupport  = alphaSupport;

        NewTextureSize(outputWidth, outputHeight);
#endif
#if UNITY_EDITOR_MAC || UNITY_STANDALONE_OSX
        this.gameObject.SetActive(false);
        funnel = gameObject.AddComponent <Funnel.Funnel>(); //to prevent awake method to execute before its variable initialization

        funnel.antiAliasing = antiAliasing;
        funnel.discardAlpha = discardAlpha;
        funnel.renderMode   = renderMode;
#endif
        this.gameObject.SetActive(true);
        isSendingTexture = true;
        this.enabled     = SpoutOutput;
    }
Exemple #4
0
 public void AddSyphon()
 {
             #if UNITY_EDITOR_OSX
     Funnel.Funnel f = mainCamera.gameObject.AddComponent <Funnel.Funnel> ();
     mainCamera.gameObject.name = serverData.GetSyphonClientName();
     f.renderMode = Funnel.Funnel.RenderMode.PreviewOnGameView;
     f.enabled    = false;
     //mainCamera.gameObject.AddComponent<Syphon> ();
     //mainCamera.gameObject.GetComponent<Syphon> ().runInEditMode = true;
     //mainCamera.gameObject.AddComponent<SyphonServerTexture> ();
             #elif UNITY_STANDALONE_OSX
     Funnel.Funnel f = mainCamera.gameObject.AddComponent <Funnel.Funnel> ();
     mainCamera.gameObject.name = serverData.GetSyphonClientName();
     f.renderMode = Funnel.Funnel.RenderMode.PreviewOnGameView;
     f.enabled    = false;
     //mainCamera.gameObject.AddComponent<Syphon> ();
     //mainCamera.gameObject.AddComponent<SyphonServerTexture> ();
             #endif
 }