Play() public method

Starts the camera.

public Play ( ) : void
return void
コード例 #1
4
ファイル: CameraController.cs プロジェクト: tsi25/Alfred
 void Start()
 {
     mCamera = new WebCamTexture ();
     mCamera.Play ();
     gameObject.GetComponent<Renderer> ().material.mainTexture = mCamera;
     if(!mCamera.isPlaying) mCamera.Play ();
 }
コード例 #2
0
ファイル: AugReality.cs プロジェクト: javageek68/mikulus
    /// <summary>
    /// 
    /// </summary>
    void Start()
    {
        webcamTexture = new WebCamTexture();

        matWeb.mainTexture = webcamTexture;
        webcamTexture.Play();
    }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        var devices = WebCamTexture.devices;
        if ( devices.Length == 0 ) {
            Debug.LogError( "Webカメラが検出できませんでした。" );
            return;
        }

        // WebCamテクスチャを作成する
        var webcamTexture = new WebCamTexture( Width, Height, FPS );
        renderer.material.mainTexture = webcamTexture;
        webcamTexture.Play();

        // ミラーリング
        if ( Mirror ) {
            transform.localScale = new Vector3( -transform.localScale.x, transform.localScale.y, transform.localScale.z );
        }

        // 縦にする
        if ( RightUp ) {
            var euler = transform.localRotation.eulerAngles;
            transform.localRotation = Quaternion.Euler( euler.x, euler.y, euler.z + 90 );
        }
        else if ( LeftUp ) {
            var euler = transform.localRotation.eulerAngles;
            transform.localRotation = Quaternion.Euler( euler.x, euler.y, euler.z - 90 );
        }
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        // Ensure orientation and scaling of the image.
        var scale = 2.2f;
        Quaternion rotation = Quaternion.Euler(0, 0, 0);
        Matrix4x4 rotationMatrix = Matrix4x4.TRS(Vector3.zero, rotation, new Vector3(scale , scale , scale));
        gameObject.GetComponent<Renderer>().material.SetMatrix("_Rotation", rotationMatrix);

        int t = 0;
        bool front_facing = false;

        WebCamDevice[] devices = WebCamTexture.devices;

        // Gets the back facing camera if there is one on the device
        while(front_facing && t < devices.Length){
            deviceName = devices[t].name;
            front_facing = devices[t].isFrontFacing;
            t++;
        }

        webcamTexture = new WebCamTexture(deviceName);

        // performs the vertical axis flip
        if (!front_facing) {
            transform.Rotate(new Vector3(0,0,180));
        }

        // performs the horizontal axis flip that is the issue regardless
        transform.localScale = new Vector3(-1 * transform.localScale.x,
                                           transform.localScale.y,
                                           transform.localScale.z);

        GetComponent<Renderer>().material.mainTexture = webcamTexture;
        webcamTexture.Play();
    }
コード例 #5
0
ファイル: AddMemory.cs プロジェクト: Chenoso/Stephanie
	void LoadConfigs(){
		webcamTexture = new WebCamTexture (480, 320, 30);
		
		myURL = Config.masterURL;
		fileName = Config.currentChild;
		totalMemories = Config.currentChildDayMemoriesCount;

		Debug.Log ("Total memories: " + totalMemories);
		
		myURL += "?webfilename=" + fileName +
			"&webusername="******"&webpassword="******"";
		descriptionUILabel.value = "";

		photoUITexture.mainTexture = null;
		
#if UNITY_EDITOR
		webcamTexture = new WebCamTexture ();
		photoUITexture.mainTexture = webcamTexture;
		webcamTexture.Play ();
#endif
#if UNITY_IOS
		PromptForPhoto ();
#endif
	}
コード例 #6
0
ファイル: VJWebCam.cs プロジェクト: 8monolith8/fuze-vj-kit
    public void SetWebCamTexture(int w, int h, int f)
    {
        width = w;
        height = h;
        fps = f;

        if(Application.isPlaying){

            if( null != webcam ) {
                webcam.Stop();
                Destroy(webcam);
            }

            webcam = new WebCamTexture(w, h, f);

            if(targetMaterial == null) {
                targetMaterial = renderer.material;
            }

            if(texturePropertyName == null || texturePropertyName.Length == 0) {
                targetMaterial.mainTexture = webcam;
            } else {
                targetMaterial.SetTexture(texturePropertyName, webcam);
            }

            webcam.Play();
        }
    }
コード例 #7
0
    void Start()
    {
        if(PlayerPrefs.GetInt("Win",2)==1)
        {
            Winner.sprite=Bear;
        }
        else
        {
            Winner.sprite=Lion;
        }

        webCamTexture = new WebCamTexture("Camera 1");
        //webCamTexture = new WebCamTexture();

        Texture2D photo = new Texture2D(webCamTexture.width, webCamTexture.height);

        m_RendererPhoto.material.mainTexture = webCamTexture;

         //StartVideo
        webCamTexture.Play();

        //Set Mode
        m_PhotoMode = true;
        m_RendererPhoto.gameObject.SetActive(m_PhotoMode);
        m_RendererRendu.gameObject.SetActive(!m_PhotoMode);
    }
コード例 #8
0
    // Use this for initialization
    void Start()
    {
        WebCamDevice[] devices = WebCamTexture.devices;
        // display all cameras
        for (var i = 0; i < devices.Length; i++) {
            Debug.Log (devices [i].name);
        }

        imageObj = GameObject.Find("RawImage").gameObject as GameObject;

        string deviceName = devices [0].name;
        foreach (var device in WebCamTexture.devices) {
            if (device.isFrontFacing) {
                deviceName = device.name;
            }
        }

        webcamTexture = new WebCamTexture(deviceName, Width, Height, FPS);

        if (webcamTexture == null) {
            Debug.Log (webcamTexture);
        }
        webcamTexture.Play();

        imageObj.GetComponent<RawImage>().texture = webcamTexture;
    }
コード例 #9
0
 public static void Init(string deviceName, int requestedWidth, int requestedHeight, int requestedFps, BitDepth targetBitDepth)
 {
     WebCamTexture = new WebCamTexture(deviceName, requestedWidth, requestedHeight, requestedFps);
     WebCamTexture.Play();
     if (!WebCamTextureProxy.instance)
         new GameObject("_webcamtextureproxy") { hideFlags = HideFlags.HideAndDontSave }.AddComponent<WebCamTextureProxy>().SetTargetTexture(WebCamTexture).SetTargetDepth(targetBitDepth).StartCapture();
 }
コード例 #10
0
ファイル: Webcam.cs プロジェクト: sugi-cho/FlowingParticles
 // Use this for initialization
 void Start()
 {
     var wc = new WebCamTexture (640, 400);
     wc.Play ();
     Shader.SetGlobalTexture (propEmit, wc);
     Shader.SetGlobalTexture (propKage, wc);
 }
コード例 #11
0
ファイル: Webcam.cs プロジェクト: leon196/DingDong
    void Update()
    {
        // Control luminance treshold
        if (Input.GetKey(KeyCode.RightArrow)) {
            treshold = Mathf.Clamp(treshold + 0.001f, 0f, 1f);
        } else if (Input.GetKey(KeyCode.LeftArrow)) {
            treshold = Mathf.Clamp(treshold - 0.001f, 0f, 1f);
        }

        // Control fade out ratio
        if (Input.GetKey(KeyCode.DownArrow)) {
            fadeOutRatio = Mathf.Clamp(fadeOutRatio - 0.001f, 0f, 1f);
        } else if (Input.GetKey(KeyCode.UpArrow)) {
            fadeOutRatio = Mathf.Clamp(fadeOutRatio + 0.001f, 0f, 1f);
        }

        // Switch camera
        if (Input.GetKeyDown(KeyCode.C)) {
            if (WebCamTexture.devices.Length > 1) {
                currentWebcam = (currentWebcam + 1) % WebCamTexture.devices.Length;
                textureWebcam.Stop();
                textureWebcam = new WebCamTexture(WebCamTexture.devices[currentWebcam].name);
                Shader.SetGlobalTexture("_TextureWebcam", textureWebcam);
                textureWebcam.Play();
            }
        }

        if (Input.anyKey) {
            UpdateUniforms();
        }
    }
コード例 #12
0
ファイル: CameraTexture.cs プロジェクト: joelmuzz/Emgu-CV
   // Use this for initialization
   void Start()
   {
      WebCamDevice[] devices = WebCamTexture.devices;
      int cameraCount = devices.Length;

      if (cameraCount == 0)
      {
         Image<Bgr, Byte> img = new Image<Bgr, byte>(640, 240);
         CvInvoke.PutText(img, String.Format("{0} camera found", devices.Length), new System.Drawing.Point(10, 60),
            Emgu.CV.CvEnum.FontFace.HersheyDuplex,
            1.0, new MCvScalar(0, 255, 0));
         Texture2D texture = TextureConvert.ImageToTexture2D(img, FlipType.Vertical);

         this.GetComponent<GUITexture>().texture = texture;
         this.GetComponent<GUITexture>().pixelInset = new Rect(-img.Width/2, -img.Height/2, img.Width, img.Height);
      }
      else
      {
         webcamTexture = new WebCamTexture(devices[0].name);

         baseRotation = transform.rotation;
         webcamTexture.Play();
         //data = new Color32[webcamTexture.width * webcamTexture.height];
         CvInvoke.CheckLibraryLoaded();
      }
   }
コード例 #13
0
 static public int Play(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         self.Play();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
コード例 #14
0
 // Use this for initialization
 void Start()
 {
     WebCamTexture webcamTexture = new WebCamTexture();
     Renderer renderer = GetComponent<Renderer>();
     renderer.material.mainTexture = webcamTexture;
     webcamTexture.Play();
 }
コード例 #15
0
ファイル: WebcamTest.cs プロジェクト: nullsquid/UnityLiveCam
 // Use this for initialization
 void Start()
 {
     webcam = new WebCamTexture();
        GetComponent<Renderer>().material.mainTexture = webcam;
        webcam.Play();
     //webcam.videoVerticallyMirrored
 }
コード例 #16
0
ファイル: webcamui.cs プロジェクト: tejerolucas/Social-Drive
 void Awake()
 {
     WebCamTexture webcam=new WebCamTexture();
     imagen.texture = webcam;
     imagen.material.mainTexture=webcam;
     webcam.Play();
 }
コード例 #17
0
ファイル: WebCam.cs プロジェクト: e-solus/occultreality
 // Use this for initialization
 void Start()
 {
     // load image from camera
     back = new WebCamTexture ();
     renderer.material.mainTexture = back;
     back.Play ();
 }
コード例 #18
0
ファイル: MostrarCamara.cs プロジェクト: Geeker-GNF/RAsE2
 void Start()
 {
     WebCamTexture webcamTexture = new WebCamTexture();
     rawimage.texture = webcamTexture;
     rawimage.material.mainTexture = webcamTexture;
     webcamTexture.Play();
 }
コード例 #19
0
    private string _SavePath = ""; //Change the path here!

    #endregion Fields

    #region Methods

    // Use this for initialization
    void Start()
    {
        WebCamDevice[] devices = WebCamTexture.devices;
        deviceName = devices[0].name;
        wct = new WebCamTexture(deviceName, 400, 300, 12);
        GetComponent<Renderer>().material.mainTexture = wct;
        wct.Play();
    }
コード例 #20
0
 void WebCameraTextureSetting()
 {
     WebCamDevice[] devices = WebCamTexture.devices;
     webcamTexture = new WebCamTexture(devices[0].name, width, height, FPS);
     rawimage.texture = webcamTexture;
     rawimage.material.mainTexture = webcamTexture;
     webcamTexture.Play();
 }
コード例 #21
0
 // Initialization
 void Start()
 {
     // Resolution of input should be 3600 x 600 or something with the same ratio
     //WebCamDevice[] devices = WebCamTexture.devices;
     webcamTexture = new WebCamTexture (webcamName);
     webcamTexture.Play ();
     GetComponent<Renderer> ().material.mainTexture = webcamTexture;
 }
コード例 #22
0
 void Start()
 {
     CameraTexture = new WebCamTexture("Remote Front Camera");
     CameraTexture.Stop();
     CameraTexture.Play();
     Display.texture = CameraTexture;
     Display.material.mainTexture = CameraTexture;
 }
コード例 #23
0
ファイル: CameraWall.cs プロジェクト: akakim/newHandler
 //public Quaternion basesRotation;
 // Use this for initialization
 void Start()
 {
     webcamTexture = new WebCamTexture ();
     GetComponent<Renderer>().material.mainTexture = webcamTexture;
     webcamTexture.requestedWidth = 1280;
     webcamTexture.requestedHeight = 720;
     webcamTexture.Play ();
 }
コード例 #24
0
ファイル: WebCam.cs プロジェクト: ResponsiveAG/Andi
    // Use this for initialization
    void Start()
    {
        WebCamTexture wt = new WebCamTexture();
        r = this.GetComponent<Renderer>();

        r.material.mainTexture = wt;
        wt.Play();
    }
コード例 #25
0
ファイル: Webcam.cs プロジェクト: valeryjacobs/TIMTLTS
    // Use this for initialization
    void Start()
    {
        webcam = new WebCamTexture("Microsoft LifeCam Rear");//"Microsoft LifeCam HD-6000");// "Microsoft LifeCam Front");

        Renderer rend = GetComponent<Renderer>();

        rend.material.mainTexture = webcam;

        try
        {
            webcam.Play();
        }
        catch (Exception e)
        {
            webcam.Play();
        }
    }
コード例 #26
0
 public override void OnEnter()
 {
     webCamTexture = new WebCamTexture();
     webCamTexture.deviceName = webcamName.Value;
     webcamMaterial.Value.SetTexture("_MainTex", webCamTexture);
     webCamTexture.Play();
     Finish();
 }
コード例 #27
0
    // Starts the default camera and assigns the texture to the current renderer
    void Start()
    {
        webCamDevice = new WebCamDevice();

        webcamTexture = new WebCamTexture(webCamDevice.name,800,600,1);
        renderer.material.mainTexture = webcamTexture;
        webcamTexture.Play();
    }
コード例 #28
0
	// Use this for initialization
	void Start () {

		WebCamTexture webcamTexture = new WebCamTexture();
		webcamTexture.Play();
		MyWebcam.GetComponent<UITexture>().mainTexture = webcamTexture;

	
	}
コード例 #29
0
ファイル: CameraDataprovider.cs プロジェクト: ndob/yarrar
 void Awake()
 {
     m_webcamTexture = new WebCamTexture();
     var rawImage = GetComponent<RawImage>();
     rawImage.texture = m_webcamTexture;
     rawImage.material.mainTexture = m_webcamTexture;
     m_webcamTexture.Play();
 }
コード例 #30
0
    public void StartStream(int width, int height, int fps)
    {
        if (texture != null)
            return;

        texture = new WebCamTexture(internalName, width, height, fps);
        texture.Play();
        Debug.Log("Starting WebCam: " + name + " ("+ texture.width + ", " + texture.height + ")");
    }
コード例 #31
0
    void Start()
    {
        webCam = new WebCamTexture(4096, 4096);

        material = GetComponent<Renderer>().material;
        material.mainTexture = webCam;

        webCam.Play();
    }
コード例 #32
0
 static public int Play(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         self.Play();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #33
0
 static public int Play(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         self.Play();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }