コード例 #1
0
    public void ResetConfiguration()
    {
        centerCameraCorners = new RUISKeystoning.KeystoningCorners();
        leftCameraCorners   = new RUISKeystoning.KeystoningCorners();
        rightCameraCorners  = new RUISKeystoning.KeystoningCorners();

        centerSpec = new RUISKeystoning.KeystoningSpecification();
        leftSpec   = new RUISKeystoning.KeystoningSpecification();
        rightSpec  = new RUISKeystoning.KeystoningSpecification();
    }
コード例 #2
0
    void Update()
    {
        if (!isEditing)
        {
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            //figure out if we should start dragging some corner
            Camera camUnderClick = ruisCamera.associatedDisplay.GetCameraForScreenPoint(Input.mousePosition);
            if (camUnderClick == ruisCamera.centerCamera)
            {
                currentlyDragging       = centerCameraCorners;
                cameraUnderModification = camUnderClick;
            }
            else if (camUnderClick == ruisCamera.leftCamera)
            {
                currentlyDragging       = leftCameraCorners;
                cameraUnderModification = camUnderClick;
            }
            else if (camUnderClick == ruisCamera.rightCamera)
            {
                currentlyDragging       = rightCameraCorners;
                cameraUnderModification = camUnderClick;
            }

            if (currentlyDragging != null)
            {
                draggedCornerIndex = currentlyDragging.GetClosestCornerIndex(cameraUnderModification.ScreenToViewportPoint(Input.mousePosition));
            }

            if (draggedCornerIndex == -1)
            {
                ResetDrag();
            }
        }
        else if (Input.GetMouseButtonUp(0))
        {
            ResetDrag();

            //Optimize();
        }

        if (currentlyDragging != null)
        {
            Vector2 newPos = cameraUnderModification.ScreenToViewportPoint(Input.mousePosition);
            newPos.x = Mathf.Clamp01(newPos.x);
            newPos.y = Mathf.Clamp01(newPos.y);
            currentlyDragging[draggedCornerIndex] = newPos;
        }

        Optimize();
    }
コード例 #3
0
	void Awake () {
        ruisCamera = GetComponent<RUISCamera>();

        centerCameraCorners = new RUISKeystoning.KeystoningCorners();
        leftCameraCorners = new RUISKeystoning.KeystoningCorners();
        rightCameraCorners = new RUISKeystoning.KeystoningCorners();

        centerSpec = new RUISKeystoning.KeystoningSpecification();
        leftSpec = new RUISKeystoning.KeystoningSpecification();
        rightSpec = new RUISKeystoning.KeystoningSpecification();
	}
コード例 #4
0
    void Awake()
    {
        ruisCamera = GetComponent <RUISCamera>();

        centerCameraCorners = new RUISKeystoning.KeystoningCorners();
        leftCameraCorners   = new RUISKeystoning.KeystoningCorners();
        rightCameraCorners  = new RUISKeystoning.KeystoningCorners();

        centerSpec = new RUISKeystoning.KeystoningSpecification();
        leftSpec   = new RUISKeystoning.KeystoningSpecification();
        rightSpec  = new RUISKeystoning.KeystoningSpecification();
    }
コード例 #5
0
	void Update () {
        switch (whichCamera)
        {
            case WhichCamera.Center:
                corners = keystoningConfigurator.centerCameraCorners;
                break;
            case WhichCamera.Left:
                corners = keystoningConfigurator.leftCameraCorners;
                break;
            case WhichCamera.Right:
                corners = keystoningConfigurator.rightCameraCorners;
                break;
        }
	}
コード例 #6
0
	void Update () {
        if (!isEditing) return;

	    if(Input.GetMouseButtonDown(0)){
            //figure out if we should start dragging some corner
            Camera camUnderClick = ruisCamera.associatedDisplay.GetCameraForScreenPoint(Input.mousePosition);
            if (camUnderClick == ruisCamera.centerCamera)
            {
                currentlyDragging = centerCameraCorners;
                cameraUnderModification = camUnderClick;
                
            }
            else if (camUnderClick == ruisCamera.leftCamera)
            {
                currentlyDragging = leftCameraCorners;
                cameraUnderModification = camUnderClick;
            }
            else if (camUnderClick == ruisCamera.rightCamera)
            {
                currentlyDragging = rightCameraCorners;
                cameraUnderModification = camUnderClick;
            }

            if (currentlyDragging != null)
            {
                draggedCornerIndex = currentlyDragging.GetClosestCornerIndex(cameraUnderModification.ScreenToViewportPoint(Input.mousePosition));
            }

            if (draggedCornerIndex == -1)
            {
                ResetDrag();
            }
        }
        else if (Input.GetMouseButtonUp(0))
        {
            ResetDrag();

            //Optimize();
        }

        if (currentlyDragging != null)
        {
            Vector2 newPos = cameraUnderModification.ScreenToViewportPoint(Input.mousePosition);
            newPos.x = Mathf.Clamp01(newPos.x);
            newPos.y = Mathf.Clamp01(newPos.y);
            currentlyDragging[draggedCornerIndex] = newPos;
        }
		
		Optimize ();
	}
コード例 #7
0
    void Awake()
    {
        ruisCamera = GetComponent <RUISCamera>();
        if (!ruisCamera)
        {
            Debug.LogWarning("GameObject " + name + " has " + typeof(RUISKeystoningConfiguration) + " script, but it is missing "
                             + typeof(RUISCamera) + "script. These two should always be together in the same gameObject.");
        }

        centerCameraCorners = new RUISKeystoning.KeystoningCorners();
        leftCameraCorners   = new RUISKeystoning.KeystoningCorners();
        rightCameraCorners  = new RUISKeystoning.KeystoningCorners();

        centerSpec = new RUISKeystoning.KeystoningSpecification();
        leftSpec   = new RUISKeystoning.KeystoningSpecification();
        rightSpec  = new RUISKeystoning.KeystoningSpecification();
    }
コード例 #8
0
    void Update()
    {
        switch (whichCamera)
        {
        case WhichCamera.Center:
            corners = keystoningConfigurator.centerCameraCorners;
            break;

        case WhichCamera.Left:
            corners = keystoningConfigurator.leftCameraCorners;
            break;

        case WhichCamera.Right:
            corners = keystoningConfigurator.rightCameraCorners;
            break;
        }
    }
コード例 #9
0
ファイル: XmlImportExport.cs プロジェクト: qipa/NordeusNinja
    public static bool ExportKeystoning(RUISKeystoning.KeystoningCorners keystoningCorners, XmlElement xmlElement)
    {
        XmlElement topLeft = xmlElement.OwnerDocument.CreateElement("topLeft");

        XMLUtil.WriteVector2ToXmlElement(topLeft, keystoningCorners[0]);
        xmlElement.AppendChild(topLeft);

        XmlElement topRight = xmlElement.OwnerDocument.CreateElement("topRight");

        XMLUtil.WriteVector2ToXmlElement(topRight, keystoningCorners[1]);
        xmlElement.AppendChild(topRight);

        XmlElement bottomRight = xmlElement.OwnerDocument.CreateElement("bottomRight");

        XMLUtil.WriteVector2ToXmlElement(bottomRight, keystoningCorners[2]);
        xmlElement.AppendChild(bottomRight);

        XmlElement bottomLeft = xmlElement.OwnerDocument.CreateElement("bottomLeft");

        XMLUtil.WriteVector2ToXmlElement(bottomLeft, keystoningCorners[3]);
        xmlElement.AppendChild(bottomLeft);

        return(true);
    }
コード例 #10
0
 private void ResetDrag()
 {
     currentlyDragging       = null;
     cameraUnderModification = null;
     draggedCornerIndex      = -1;
 }
コード例 #11
0
 public static bool ExportKeystoning(RUISKeystoning.KeystoningCorners keystoningCorners, XmlElement xmlElement)
 {
     return(true);
 }
コード例 #12
0
    public void ResetConfiguration()
    {
        centerCameraCorners = new RUISKeystoning.KeystoningCorners();
        leftCameraCorners = new RUISKeystoning.KeystoningCorners();
        rightCameraCorners = new RUISKeystoning.KeystoningCorners();

        centerSpec = new RUISKeystoning.KeystoningSpecification();
        leftSpec = new RUISKeystoning.KeystoningSpecification();
        rightSpec = new RUISKeystoning.KeystoningSpecification();
    }
コード例 #13
0
 private void ResetDrag()
 {
     currentlyDragging = null;
     cameraUnderModification = null;
     draggedCornerIndex = -1;
 }