Exemple #1
0
 // Update is called once per frame
 void Update()
 {
     if (balloonygenManagerPtr.getCameraTextureType() == CameraTextureType.CAMERA_TEXTURE_TYPE_SRC)
     {
         cameraTexturePtr[0] = balloonygenManagerPtr.getSrcCameraImageTexturePtr();
         imagePtr.material.SetTexture("_MainTex", cameraTexturePtr[0].texture);
     }
     else if (balloonygenManagerPtr.getCameraTextureType() == CameraTextureType.CAMERA_TEXTURE_TYPE_BINARIZED)
     {
         cameraTexturePtr[1] = balloonygenManagerPtr.getBinarizedCameraImageTexturePtr();
         imagePtr.material.SetTexture("_MainTex", cameraTexturePtr[1].texture);
     }
     debugText1.text = "Data1: " + omniProCamDataArrayPtr[0].id + " " + omniProCamDataArrayPtr[0].x
                       + " " + omniProCamDataArrayPtr[0].y + " " + omniProCamDataArrayPtr[0].size;
     debugText2.text = "Data2: " + omniProCamDataArrayPtr[1].id + " " + omniProCamDataArrayPtr[1].x
                       + " " + omniProCamDataArrayPtr[1].y + " " + omniProCamDataArrayPtr[1].size;
     debugText3.text = "Data3: " + omniProCamDataArrayPtr[2].id + " " + omniProCamDataArrayPtr[2].x
                       + " " + omniProCamDataArrayPtr[2].y + " " + omniProCamDataArrayPtr[2].size;
 } // Update
	// Update is called once per frame
	void Update () {
    
    /* スケールの微調整 */
    if (!Input.GetKey(KeyCode.O)) {

      /* 縦スケールの微調整 */
      if (Input.GetKey(KeyCode.E)) {
        scale.y += 0.1f * Time.deltaTime;
        transform.localScale = scale;
      } else if (Input.GetKey(KeyCode.D)) {
        scale.y -= 0.1f * Time.deltaTime;
        transform.localScale = scale;
      }
      /* 縦スケールの微調整 */
      if (Input.GetKey(KeyCode.F)) {
        scale.x += 0.1f * Time.deltaTime;
        transform.localScale = scale;
      } else if (Input.GetKey(KeyCode.A)) {
        scale.x -= 0.1f * Time.deltaTime;
        transform.localScale = scale;
      }

    /* オフセットの設定 */
    }else {

      /* 縦オフセットの微調整 */
      if (Input.GetKey(KeyCode.E)) {
        offset.y += 0.05f * Time.deltaTime;
        transform.position = new Vector3(offset.x, 0.0f, offset.y);
      } else if (Input.GetKey(KeyCode.D)) {
        offset.y -= 0.05f * Time.deltaTime;
        transform.position = new Vector3(offset.x, 0.0f, offset.y);
      }
      

      /* 横オフセットの微調整 */
      if (Input.GetKey(KeyCode.F)) {
        offset.x += 0.05f * Time.deltaTime;
        transform.position = new Vector3(offset.x, 0.0f, offset.y);
      } else if (Input.GetKey(KeyCode.A)) {
        offset.x -= 0.05f * Time.deltaTime;
        transform.position = new Vector3(offset.x, 0.0f, offset.y);
      }
    }

    /* 縦オフセットの微調整 */
    if (Input.GetKey(KeyCode.E)) {
      offset.y += 0.05f * Time.deltaTime;
      transform.position = new Vector3(offset.x, 0.0f, offset.y);
    }

    /* 2値化閾値 */
    if (Input.GetKey(KeyCode.UpArrow)) {
      binarizingThreshold += 1.0f;
      if (binarizingThreshold >= 255.0f) {
        binarizingThreshold = 255;
      }
      LibOmniProCam.setBinarizingThreshold(binarizingThreshold);
      print("BinarizingThreshold: " + binarizingThreshold);
    } else if (Input.GetKey(KeyCode.DownArrow)) {
      binarizingThreshold -= 1.0f;
      if (binarizingThreshold <= 0.0f) {
        binarizingThreshold = 0;
      }
      LibOmniProCam.setBinarizingThreshold(binarizingThreshold);
      print("BinarizingThreshold: " + binarizingThreshold);
    }

    ///* 高さ */
    //if (Input.GetKey(KeyCode.PageUp)) {
    //  transform.Translate(0.0f, 0.1f * Time.deltaTime, 0.0f);
    //} else if (Input.GetKey(KeyCode.PageDown)) {
    //  transform.Translate(0.0f, -0.1f * Time.deltaTime, 0.0f);
    //}

    /* 書き出し */
    if (Input.GetKeyDown(KeyCode.Alpha0)) {
      if (omniProCamDeviceManagerPtr.getCameraTextureType() == CameraTextureType.CAMERA_TEXTURE_TYPE_BINARIZED) {
        omniProCamDeviceManagerPtr.setCameraTextureType(CameraTextureType.CAMERA_TEXTURE_TYPE_SRC);
        print("CameraTextureType: Src");
      } else {
        omniProCamDeviceManagerPtr.setCameraTextureType(CameraTextureType.CAMERA_TEXTURE_TYPE_BINARIZED);
        print("CameraTextureType: Binarized");
      }
    }

    OmniProCamData[] ptr = omniProCamDeviceManagerPtr.getOmniProCamDataArrayPtr();
    foreach (OmniProCamData i in ptr) {
      if (i.id != 0) {
      }
    }

    if (omniProCamDeviceManagerPtr.getCameraTextureType() == CameraTextureType.CAMERA_TEXTURE_TYPE_BINARIZED) {
      meshRenderer.material.SetTexture("_MainTex", omniProCamDeviceManagerPtr.getBinarizedCameraImageTexturePtr().texture);
    } else {
      meshRenderer.material.SetTexture("_MainTex", omniProCamDeviceManagerPtr.getSrcCameraImageTexturePtr().texture);
    }
  }