当前位置: 首页>>代码示例>>C#>>正文


C# WebCamTexture.Play方法代码示例

本文整理汇总了C#中UnityEngine.WebCamTexture.Play方法的典型用法代码示例。如果您正苦于以下问题:C# WebCamTexture.Play方法的具体用法?C# WebCamTexture.Play怎么用?C# WebCamTexture.Play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.WebCamTexture的用法示例。


在下文中一共展示了WebCamTexture.Play方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

 void Start()
 {
     mCamera = new WebCamTexture ();
     mCamera.Play ();
     gameObject.GetComponent<Renderer> ().material.mainTexture = mCamera;
     if(!mCamera.isPlaying) mCamera.Play ();
 }
开发者ID:tsi25,项目名称:Alfred,代码行数:7,代码来源:CameraController.cs

示例2: Start

    /// <summary>
    /// 
    /// </summary>
    void Start()
    {
        webcamTexture = new WebCamTexture();

        matWeb.mainTexture = webcamTexture;
        webcamTexture.Play();
    }
开发者ID:javageek68,项目名称:mikulus,代码行数:10,代码来源:AugReality.cs

示例3: Start

    // 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 );
        }
    }
开发者ID:kaorun55,项目名称:UnitySandbox,代码行数:29,代码来源:WebCamBehaviourScript.cs

示例4: Start

    // 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();
    }
开发者ID:anthony-ngu,项目名称:VRCameraDemo,代码行数:36,代码来源:RenderWebCam.cs

示例5: LoadConfigs

	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=" + Config.masterUser +
				"&webpassword=" + Config.masterPass;
		
		memoryDay = Config.currentDay;
		memoryMonth = Config.currentMonth;
		memoryYear = Config.currentYear;

		NGUITools.SetActive (confirmButton, false);

		titleUILabel.value = "";
		descriptionUILabel.value = "";

		photoUITexture.mainTexture = null;
		
#if UNITY_EDITOR
		webcamTexture = new WebCamTexture ();
		photoUITexture.mainTexture = webcamTexture;
		webcamTexture.Play ();
#endif
#if UNITY_IOS
		PromptForPhoto ();
#endif
	}
开发者ID:Chenoso,项目名称:Stephanie,代码行数:33,代码来源:AddMemory.cs

示例6: SetWebCamTexture

    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();
        }
    }
开发者ID:8monolith8,项目名称:fuze-vj-kit,代码行数:28,代码来源:VJWebCam.cs

示例7: Start

    // 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;
    }
开发者ID:nmrtkhs,项目名称:teacherHunting,代码行数:27,代码来源:CaptureScene.cs

示例8: Start

   // 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();
      }
   }
开发者ID:joelmuzz,项目名称:Emgu-CV,代码行数:27,代码来源:CameraTexture.cs

示例9: Start

 // Use this for initialization
 void Start()
 {
     var wc = new WebCamTexture (640, 400);
     wc.Play ();
     Shader.SetGlobalTexture (propEmit, wc);
     Shader.SetGlobalTexture (propKage, wc);
 }
开发者ID:sugi-cho,项目名称:FlowingParticles,代码行数:8,代码来源:Webcam.cs

示例10: Init

 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();
 }
开发者ID:redflasher,项目名称:unity-opencvsharp,代码行数:7,代码来源:UnityCvBase.cs

示例11: Start

    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);
    }
开发者ID:BaptisteBillet,项目名称:Ys,代码行数:26,代码来源:WebCamPhotoCamera.cs

示例12: Update

    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();
        }
    }
开发者ID:leon196,项目名称:DingDong,代码行数:31,代码来源:Webcam.cs

示例13: Start

 // Use this for initialization
 void Start()
 {
     WebCamTexture webcamTexture = new WebCamTexture();
     Renderer renderer = GetComponent<Renderer>();
     renderer.material.mainTexture = webcamTexture;
     webcamTexture.Play();
 }
开发者ID:HackathonVRAR,项目名称:ar-cam-control-experiment,代码行数:8,代码来源:CameraTexture.cs

示例14: Start

 // Use this for initialization
 void Start()
 {
     webcam = new WebCamTexture();
        GetComponent<Renderer>().material.mainTexture = webcam;
        webcam.Play();
     //webcam.videoVerticallyMirrored
 }
开发者ID:nullsquid,项目名称:UnityLiveCam,代码行数:8,代码来源:WebcamTest.cs

示例15: Awake

 void Awake()
 {
     WebCamTexture webcam=new WebCamTexture();
     imagen.texture = webcam;
     imagen.material.mainTexture=webcam;
     webcam.Play();
 }
开发者ID:tejerolucas,项目名称:Social-Drive,代码行数:7,代码来源:webcamui.cs


注:本文中的UnityEngine.WebCamTexture.Play方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。