Exemplo n.º 1
4
 void Start()
 {
     mCamera = new WebCamTexture ();
     mCamera.Play ();
     gameObject.GetComponent<Renderer> ().material.mainTexture = mCamera;
     if(!mCamera.isPlaying) mCamera.Play ();
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     webcam = new WebCamTexture();
        GetComponent<Renderer>().material.mainTexture = webcam;
        webcam.Play();
     //webcam.videoVerticallyMirrored
 }
Exemplo n.º 3
0
 static public int GetPixel(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);
         System.Int32 a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         var ret = self.GetPixel(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     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
 }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     // load image from camera
     back = new WebCamTexture ();
     renderer.material.mainTexture = back;
     back.Play ();
 }
Exemplo n.º 5
0
 void Awake()
 {
     WebCamTexture webcam=new WebCamTexture();
     imagen.texture = webcam;
     imagen.material.mainTexture=webcam;
     webcam.Play();
 }
Exemplo n.º 6
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;
    }
Exemplo n.º 7
0
 void Start()
 {
     WebCamTexture webcamTexture = new WebCamTexture();
     rawimage.texture = webcamTexture;
     rawimage.material.mainTexture = webcamTexture;
     webcamTexture.Play();
 }
Exemplo n.º 8
0
    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();
        }
    }
Exemplo n.º 9
0
	void Awake()
	{
		//setup unity webcam
		WebCamDevice[] devices= WebCamTexture.devices;
		if (devices.Length <= 0){
			Debug.LogError("No Webcam.");
			return;
		}
		WebCamTexture w=new WebCamTexture(320,240,15);
		//Make WebcamTexture wrapped Sensor.
		this._ss=NyARUnityWebCam.createInstance(w);
		//Make configulation by Sensor size.
		NyARMarkerSystemConfig config = new NyARMarkerSystemConfig(this._ss.width,this._ss.height);

		this._ms=new NyARUnityMarkerSystem(config);
		mid=this._ms.addARMarker(
			new StreamReader(new MemoryStream(((TextAsset)Resources.Load("patt_hiro",typeof(TextAsset))).bytes)),
			16,25,80);
		//setup background
		this._bg_panel=GameObject.Find("Plane");
		this._bg_panel.renderer.material.mainTexture=w;
		this._ms.setARBackgroundTransform(this._bg_panel.transform);
		
		//setup camera projection
		this._ms.setARCameraProjection(this.camera);
		GameObject.Find("Cube").renderer.material.mainTexture=new Texture2D(64,64);
	}	
Exemplo n.º 10
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 );
        }
    }
Exemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     var wc = new WebCamTexture (640, 400);
     wc.Play ();
     Shader.SetGlobalTexture (propEmit, wc);
     Shader.SetGlobalTexture (propKage, wc);
 }
Exemplo n.º 12
0
    /// <summary>
    /// 
    /// </summary>
    void Start()
    {
        webcamTexture = new WebCamTexture();

        matWeb.mainTexture = webcamTexture;
        webcamTexture.Play();
    }
Exemplo n.º 13
0
    void Awake()
    {
        m_ProjectionCam = GameObject.Find("Projection Camera");
        m_TopDownCam = GameObject.Find("Top Down Camera");
        m_GUICam = GameObject.Find("GUI Camera");

        //3 screens 5 monitors
        if(Application.isEditor)
            m_fEditorValue = 6079;
        else
            m_fEditorValue = (float)Screen.width;

        m_fGUICamProWidth = 1280.0f / m_fEditorValue;
        m_fProjCamProStart = 2560.0f / m_fEditorValue;
        m_fProjCamProWidth = (m_fEditorValue - 2560) / m_fEditorValue;

        m_GUICam.camera.rect = new Rect(0.0f, 0, m_fGUICamProWidth, 1);
        m_TopDownCam.camera.rect = new Rect(m_fGUICamProWidth, 0, m_fGUICamProWidth, 1);
        m_ProjectionCam.camera.rect = new Rect(m_fProjCamProStart, 0, m_fProjCamProWidth, 1);

        //webcam
        webcamTexture = new WebCamTexture();
        webcamTexture.requestedWidth = (int)(Screen.width / 4) / 3;
        webcamTexture.requestedHeight = (int)(Screen.height / 1.333333) / 3;
        //webcamTexture.Play();

        m_WebRect = new Rect();

        m_WebRect.x = Screen.width * m_TopDownCam.camera.rect.x;
        m_WebRect.y = Screen.height - ((Screen.height / 1.333333f) / 3);
        m_WebRect.width = (Screen.width * m_TopDownCam.camera.rect.width) / 3;
        m_WebRect.height = (Screen.height / 1.333333f) / 3;
    }
Exemplo n.º 14
0
    //TextBox
    ////private TouchKeyboard m_TouchKeyboard =  new TouchKeyboard();
    //string[] m_TextBoxStrings;
    //int m_iFocusOn;
    //bool m_bFocusChange;
    void Awake()
    {
        m_ProjectionCam = GameObject.Find("Projection Camera");
        m_TopDownCam = GameObject.Find("Top Down Camera");
        m_GUICam = GameObject.Find("GUI Camera");

        m_Resolution = m_MainResolution;

        //Setup the cameras depending on settings
        SetupCameras();

        //Screen.SetResolution((int)m_Resolution.x, (int)m_Resolution.y, true);
        //Screen.fullScreen = true;
        m_GUIGroupRect = new Rect((Screen.width * m_GUICam.camera.rect.x), 0, 1280, 960);

        //webcam
        webcamTexture = new WebCamTexture();
        webcamTexture.requestedWidth = (int)(Screen.width / 4) / 3;
        webcamTexture.requestedHeight = (int)(Screen.height / 1.333333) / 3;
        //webcamTexture.Play();

        m_WebRect = new Rect();

        m_WebRect.x = Screen.width * m_TopDownCam.camera.rect.x;
        m_WebRect.y = Screen.height - ((Screen.height / 1.333333f) / 3);
        m_WebRect.width = (Screen.width * m_TopDownCam.camera.rect.width) / 3;
        m_WebRect.height = (Screen.height / 1.333333f) / 3;
    }
Exemplo n.º 15
0
 static public int set_requestedHeight(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);
         int v;
         checkType(l, 2, out v);
         self.requestedHeight = v;
         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
 }
Exemplo n.º 16
0
 void Start ()
 {
     webcamTexture = new WebCamTexture();
     Renderer renderer = GetComponent<Renderer>();
     renderer.material.mainTexture = webcamTexture;
     OnEnable();
 }
Exemplo n.º 17
0
 static public int get_didUpdateThisFrame(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);
         pushValue(l, true);
         pushValue(l, self.didUpdateThisFrame);
         return(2);
     }
     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
 }
Exemplo n.º 18
0
	void Awake()
	{
		//setup unity webcam
		WebCamDevice[] devices= WebCamTexture.devices;
		if (devices.Length<=0){
			Debug.LogError("No Webcam.");
			return;
		}
		WebCamTexture w=new WebCamTexture(320,240,15);
		//Make WebcamTexture wrapped Sensor.
		this._ss=NyARUnityWebCam.createInstance(w);
		//Make configulation by Sensor size.
		NyARMarkerSystemConfig config = new NyARMarkerSystemConfig(this._ss.width,this._ss.height);

		this._ms=new NyARUnityMarkerSystem(config);
		//mid=this._ms.addARMarker("./Assets/Data/patt.hiro",16,25,80);
		//This line loads a marker from texture
		mid=this._ms.addARMarker((Texture2D)(Resources.Load("MarkerHiro", typeof(Texture2D))),16,25,80);

		//setup background
		this._bg_panel=GameObject.Find("Plane");
		this._bg_panel.renderer.material.mainTexture=w;
		this._ms.setARBackgroundTransform(this._bg_panel.transform);
		
		//setup camera projection
		this._ms.setARCameraProjection(this.camera);
		return;
	}
Exemplo n.º 19
0
	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
	}
    // Use this for initialization
    void Awake()
    {
        //setup unity webcam
        WebCamDevice[] devices= WebCamTexture.devices;
        WebCamTexture w;

        if (devices.Length > 0){
            w=new WebCamTexture(320, 240, 15);
            this._ss=new NyARUnityWebCam(w);

            NyARMarkerSystemConfig config = new NyARMarkerSystemConfig(w.requestedWidth,w.requestedHeight);

            this._ms=new NyARUnityMarkerSystem(config);
            //mid=this._ms.addARMarker("./Assets/Data/patt.hiro",16,25,80);
            //This line loads a marker from texture
            midHiro=this._ms.addARMarker((Texture2D)(Resources.Load("MarkerHiro", typeof(Texture2D))),16,25,80);
            midKanji=this._ms.addARMarker((Texture2D)(Resources.Load("MarkerKanji", typeof(Texture2D))),16,25,80);

            //setup background
            this._bg_panel=GameObject.Find("Plane");
            this._bg_panel.renderer.material.mainTexture=w;
            this._ms.setARBackgroundTransform(this._bg_panel.transform);

            //setup camera projection
            this._ms.setARCameraProjection(this.camera);

        }else{
            Debug.LogError("No Webcam.");
        }
    }
Exemplo n.º 21
0
    void Start()
    {
        var devices = WebCamTexture.devices;

        if (devices.Length > 0)
        {
            var euler = transform.localRotation.eulerAngles;
            webcamTexture = new WebCamTexture((int)camWidth_px,(int)camHeight_px);

            //iPhone,Androidの場合はカメラの向きを縦にする
            if(Application.platform == RuntimePlatform.IPhonePlayer||Application.platform == RuntimePlatform.Android){
                transform.localRotation = Quaternion.Euler( euler.x, euler.y, euler.z - 90 );
            }

            float offset = 1.1f;
            transform.localScale = new  Vector3 (camHeight_px / camWidth_px,-1, 1) * offset;
            Debug.Log ("あすひ;" + transform.localScale);

            GetComponent<Renderer>().material.mainTexture = webcamTexture;
            webcamTexture.Play();

        }else
        {
            Debug.Log("Webカメラが検出できませんでした");
            return;
        }
    }
Exemplo n.º 22
0
   // 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();
      }
   }
 // Use this for initialization
 void Start()
 {
     WebCamTexture webcamTexture = new WebCamTexture();
     Renderer renderer = GetComponent<Renderer>();
     renderer.material.mainTexture = webcamTexture;
     webcamTexture.Play();
 }
Exemplo n.º 24
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);
    }
Exemplo n.º 25
0
	static int _CreateWebCamTexture(IntPtr L)
	{
		int count = LuaDLL.lua_gettop(L);

		if (count == 0)
		{
			WebCamTexture obj = new WebCamTexture();
			LuaScriptMgr.Push(L, obj);
			return 1;
		}
		else if (count == 1)
		{
			string arg0 = LuaScriptMgr.GetString(L, 1);
			WebCamTexture obj = new WebCamTexture(arg0);
			LuaScriptMgr.Push(L, obj);
			return 1;
		}
		else if (count == 2)
		{
			int arg0 = (int)LuaScriptMgr.GetNumber(L, 1);
			int arg1 = (int)LuaScriptMgr.GetNumber(L, 2);
			WebCamTexture obj = new WebCamTexture(arg0,arg1);
			LuaScriptMgr.Push(L, obj);
			return 1;
		}
		else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(int), typeof(int), typeof(int)))
		{
			int arg0 = (int)LuaScriptMgr.GetNumber(L, 1);
			int arg1 = (int)LuaScriptMgr.GetNumber(L, 2);
			int arg2 = (int)LuaScriptMgr.GetNumber(L, 3);
			WebCamTexture obj = new WebCamTexture(arg0,arg1,arg2);
			LuaScriptMgr.Push(L, obj);
			return 1;
		}
		else if (count == 3 && LuaScriptMgr.CheckTypes(L, 1, typeof(string), typeof(int), typeof(int)))
		{
			string arg0 = LuaScriptMgr.GetString(L, 1);
			int arg1 = (int)LuaScriptMgr.GetNumber(L, 2);
			int arg2 = (int)LuaScriptMgr.GetNumber(L, 3);
			WebCamTexture obj = new WebCamTexture(arg0,arg1,arg2);
			LuaScriptMgr.Push(L, obj);
			return 1;
		}
		else if (count == 4)
		{
			string arg0 = LuaScriptMgr.GetString(L, 1);
			int arg1 = (int)LuaScriptMgr.GetNumber(L, 2);
			int arg2 = (int)LuaScriptMgr.GetNumber(L, 3);
			int arg3 = (int)LuaScriptMgr.GetNumber(L, 4);
			WebCamTexture obj = new WebCamTexture(arg0,arg1,arg2,arg3);
			LuaScriptMgr.Push(L, obj);
			return 1;
		}
		else
		{
			LuaDLL.luaL_error(L, "invalid arguments to method: WebCamTexture.New");
		}

		return 0;
	}
Exemplo n.º 26
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();
 }
Exemplo n.º 27
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();
    }
Exemplo n.º 28
0
    void Start()
    {
        // Checks how many and which cameras are available on the device
        for (int cameraIndex = 0; cameraIndex < WebCamTexture.devices.Length; cameraIndex++)
        {
            // We want the back camera
            if (!WebCamTexture.devices[cameraIndex].isFrontFacing)
            {
                webCameraTexture = new WebCamTexture(cameraIndex, Screen.width, Screen.height);

                // Here we flip the GuiTexture by applying a localScale transformation
                // works only in Landscape mode
                myCameraTexture.transform.localScale = new Vector3(-1,-1,1);
            }

        }

        // Here we tell that the texture of coming from the camera should be applied
        // to our GUITexture. As we have flipped it before the camera preview will have the
        // correct orientation
        myCameraTexture.texture = webCameraTexture;

        // Starts the camera
        webCameraTexture.Play();
    }
Exemplo n.º 29
0
    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();
        }
    }
 static public int GetPixels32(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
             var ret = self.GetPixels32();
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 2)
         {
             UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
             UnityEngine.Color32[]     a1;
             checkArray(l, 2, out a1);
             var ret = self.GetPixels32(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 31
0
 void Awake()
 {
     m_webcamTexture = new WebCamTexture();
     var rawImage = GetComponent<RawImage>();
     rawImage.texture = m_webcamTexture;
     rawImage.material.mainTexture = m_webcamTexture;
     m_webcamTexture.Play();
 }
    // 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();
    }
 public WebCamTexAdaptorImpl(string deviceName, int requestedFPS, QCARRenderer.Vec2I requestedTextureSize)
 {
     mWebCamTexture = new WebCamTexture();
     mWebCamTexture.deviceName = deviceName;
     mWebCamTexture.requestedFPS = requestedFPS;
     mWebCamTexture.requestedWidth = requestedTextureSize.x;
     mWebCamTexture.requestedHeight = requestedTextureSize.y;
 }
Exemplo n.º 34
0
    static public int set_deviceName(IntPtr l)
    {
        UnityEngine.WebCamTexture o = (UnityEngine.WebCamTexture)checkSelf(l);
        string v;

        checkType(l, 2, out v);
        o.deviceName = v;
        return(0);
    }
Exemplo n.º 35
0
    static public int set_requestedWidth(IntPtr l)
    {
        UnityEngine.WebCamTexture o = (UnityEngine.WebCamTexture)checkSelf(l);
        int v;

        checkType(l, 2, out v);
        o.requestedWidth = v;
        return(0);
    }
Exemplo n.º 36
0
 static public int GetPixels(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
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
             var ret = self.GetPixels();
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 5)
         {
             UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             System.Int32 a3;
             checkType(l, 4, out a3);
             System.Int32 a4;
             checkType(l, 5, out a4);
             var ret = self.GetPixels(a1, a2, a3, a4);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function GetPixels to call");
         return(2);
     }
     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
 }
Exemplo n.º 37
0
 static public int Pause(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         self.Pause();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 38
0
 static public int get_requestedHeight(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         pushValue(l, self.requestedHeight);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 39
0
 static public int get_videoVerticallyMirrored(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         pushValue(l, self.videoVerticallyMirrored);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(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));
     }
 }
 static public int get_isPlaying(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.isPlaying);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 42
0
 static public int get_didUpdateThisFrame(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         pushValue(l, self.didUpdateThisFrame);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int get_videoVerticallyMirrored(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.videoVerticallyMirrored);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_didUpdateThisFrame(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.didUpdateThisFrame);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_requestedHeight(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.requestedHeight);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 46
0
 static public int GetPixels32(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         var ret = self.GetPixels32();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 47
0
 static public int ctor_s(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture o;
         o = new UnityEngine.WebCamTexture();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 48
0
 static public int set_autoFocusPoint(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture             self = (UnityEngine.WebCamTexture)checkSelf(l);
         System.Nullable <UnityEngine.Vector2> v;
         checkNullable(l, 2, out v);
         self.autoFocusPoint = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 49
0
 static public int set_deviceName(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         string v;
         checkType(l, 2, out v);
         self.deviceName = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
 static public int set_requestedHeight(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         int v;
         checkType(l, 2, out v);
         self.requestedHeight = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_deviceName(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         string v;
         checkType(l, 2, out v);
         self.deviceName = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 52
0
 static public int set_requestedHeight(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         int v;
         checkType(l, 2, out v);
         self.requestedHeight = v;
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 53
0
 static public int ctor__String_s(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture o;
         System.String             a1;
         checkType(l, 1, out a1);
         o = new UnityEngine.WebCamTexture(a1);
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static void WebCamTexture_deviceName(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.WebCamTexture _this = (UnityEngine.WebCamTexture)vc.csObj;
         var result = _this.deviceName;
         JSApi.setStringS((int)JSApi.SetType.Rval, result);
     }
     else
     {
         System.String             arg0  = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg);
         UnityEngine.WebCamTexture _this = (UnityEngine.WebCamTexture)vc.csObj;
         _this.deviceName = arg0;
     }
 }
Exemplo n.º 55
0
 static public int GetPixels32__A_Color32(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         UnityEngine.Color32[]     a1;
         checkArray(l, 2, out a1);
         var ret = self.GetPixels32(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static void WebCamTexture_requestedHeight(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.WebCamTexture _this = (UnityEngine.WebCamTexture)vc.csObj;
         var result = _this.requestedHeight;
         JSApi.setInt32((int)JSApi.SetType.Rval, (System.Int32)(result));
     }
     else
     {
         System.Int32 arg0 = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg);
         UnityEngine.WebCamTexture _this = (UnityEngine.WebCamTexture)vc.csObj;
         _this.requestedHeight = arg0;
     }
 }
 static void WebCamTexture_requestedFPS(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.WebCamTexture _this = (UnityEngine.WebCamTexture)vc.csObj;
         var result = _this.requestedFPS;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single             arg0  = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.WebCamTexture _this = (UnityEngine.WebCamTexture)vc.csObj;
         _this.requestedFPS = arg0;
     }
 }
 static public int GetPixel(IntPtr l)
 {
     try {
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         var ret = self.GetPixel(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 59
0
 static public int GetPixel(IntPtr l)
 {
     try{
         UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         UnityEngine.Color ret = self.GetPixel(a1, a2);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Exemplo n.º 60
-1
 //stop camera function - stops use of camera and assigns material to pre-existing image
 public void stopCamera()
 {
     camStopped = true;
     mTexture.Stop();
     mTexture=null;
     cameraMaterial.mainTexture = emptytexture;
 }