Esempio n. 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();
    }
Esempio n. 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();
    }
	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();
	}
    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();
    }
	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;
        }
	}
	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 ();
	}
Esempio n. 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();
    }
Esempio n. 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;
        }
    }
Esempio n. 9
0
    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);
    }
Esempio n. 10
0
 private void ResetDrag()
 {
     currentlyDragging       = null;
     cameraUnderModification = null;
     draggedCornerIndex      = -1;
 }
Esempio n. 11
0
 public static bool ExportKeystoning(RUISKeystoning.KeystoningCorners keystoningCorners, XmlElement xmlElement)
 {
     return(true);
 }
    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();
    }
 private void ResetDrag()
 {
     currentlyDragging = null;
     cameraUnderModification = null;
     draggedCornerIndex = -1;
 }