static void Drawer_Projection(HDCameraUI s, SerializedHDCamera p, Editor owner)
        {
            CameraProjection projection = p.orthographic.boolValue ? CameraProjection.Orthographic : CameraProjection.Perspective;

            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = p.orthographic.hasMultipleDifferentValues;
            projection = (CameraProjection)EditorGUILayout.EnumPopup(projectionContent, projection);
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                p.orthographic.boolValue = (projection == CameraProjection.Orthographic);
            }

            if (!p.orthographic.hasMultipleDifferentValues)
            {
                if (projection == CameraProjection.Orthographic)
                {
                    EditorGUILayout.PropertyField(p.orthographicSize, sizeContent);
                }
                else
                {
                    EditorGUILayout.Slider(p.fieldOfView, 1f, 179f, fieldOfViewContent);
                }
            }
        }
예제 #2
0
    public string jsonString()
    {
        CameraProjection cp   = CameraProjectionFromCamera(m_camera);
        string           json = cp.json();

        return(json);
    }
예제 #3
0
 public Camera3D(Vector3 position, Vector3 target, Vector3 up, float fovy, CameraProjection projection)
 {
     this.position   = position;
     this.target     = target;
     this.up         = up;
     this.fovy       = fovy;
     this.projection = projection;
 }
예제 #4
0
        public void Update(FrameTime frameTime)
        {
            var camera = globalObjectService.MainCamera;
            var frame  = new CameraFrame(camera.transform.position.ToClarity(), camera.transform.rotation.ToClarity());
            var proj   = new CameraProjection(CameraProjectionType.Perspective, camera.nearClipPlane, camera.farClipPlane, camera.fieldOfView);

            props = new CameraProps(frame.Eye + frame.Forward, frame, proj);
        }
예제 #5
0
 private void setFromCamera(out CameraProjection cp)
 {
     cp.fieldOfViewY_rad = m_camera.fieldOfView * Mathf.Deg2Rad; // vertical field of view in radians
     cp.nearClipPlane    = m_camera.nearClipPlane;
     cp.farClipPlane     = m_camera.farClipPlane;
     cp.aspect           = m_camera.aspect;
     cp.pixelWidth       = (uint)m_camera.pixelWidth;
     cp.pixelHeight      = (uint)m_camera.pixelHeight;
 }
예제 #6
0
    protected CameraProjection CurrentProjection(Material _targetMat)
    {
        CameraProjection projection = CameraProjection.Perspective;

        if (_targetMat.IsKeywordEnabled("_CAMERA_ORTHOGRAPHIC"))
        {
            projection = CameraProjection.Orthographic;
        }

        return(projection);
    }
예제 #7
0
    private void setFromHMD(out CameraProjection cp)
    {
        cp.nearClipPlane = m_camera.nearClipPlane;
        cp.farClipPlane  = m_camera.farClipPlane;

        cp.pixelWidth  = (uint)(SteamVR.instance.sceneWidth / resolutionDivisor); // SteamVR gives extended render size for symmetric projection
        cp.pixelHeight = (uint)(SteamVR.instance.sceneHeight / resolutionDivisor);

        cp.aspect           = SteamVR.instance.aspect;
        cp.fieldOfViewY_rad = SteamVR.instance.fieldOfView * Mathf.Deg2Rad; // vertical field of view in radians

        // for computation of respective values, see SteamVR/Scripts/SteamVR.cs:SteamVR()
        var textureBounds = SteamVR.instance.textureBounds; // 0 -> left; 1 -> right; uMin, uMax, vMin, vMax
        // texture bounds give us area in rendered texture which needs to be stretched onto left/right eye render target
        // TODO: publish texture bounds to correct shader for XR overlay
    }
예제 #8
0
        public void SetCameraProjection(CameraProjection SetProjectionMode, double Length)
        {
            ProjectionMode = SetProjectionMode;

            switch (ProjectionMode)
            {
            default:
                RhinoViewer.Viewport.ChangeToParallelProjection(true);
                break;

            case CameraProjection.Perspective:
                RhinoViewer.Viewport.ChangeToPerspectiveProjection(true, 50);
                RhinoViewer.Viewport.Camera35mmLensLength = Length;
                break;

            case CameraProjection.TwoPoint:
                RhinoViewer.Viewport.ChangeToTwoPointPerspectiveProjection(50);
                RhinoViewer.Viewport.Camera35mmLensLength = Length;
                break;
            }
        }
    public void onChangeCameraProjection()
    {
        if (!m_currentCreationState.Equals (CreationState.BASE)) {

            Text text = GameObject.Find ("text_camera_projection").GetComponent<Text> ();
            if (m_currentCameraProjection.Equals (CameraProjection.ORTHOGRAPHIC)) {
                text.text = "persp";
                m_currentCameraProjection = CameraProjection.PERSPECTIVE;
                m_cameraOrthoObject.SetActive (false);
                m_cameraPerspObject.SetActive (true);
                m_currentCamera = m_cameraPersp;
                m_currentCameraObject = m_cameraPerspObject;
            } else {
                text.text = "ortho";
                m_currentCameraProjection = CameraProjection.ORTHOGRAPHIC;
                m_cameraPerspObject.SetActive (false);
                m_cameraOrthoObject.SetActive (true);
                m_currentCamera = m_cameraOrtho;
                m_currentCameraObject = m_cameraOrthoObject;
            }
        }
    }
예제 #10
0
    protected virtual void DoSettingsArea(Material _targetMat, MaterialEditor _editor, MaterialProperty[] _properties)
    {
        GUILayout.Label("Settings", EditorStyles.boldLabel);

        CameraProjection projection = CurrentProjection(_targetMat);

        EditorGUI.BeginChangeCheck();
        projection = (CameraProjection)EditorGUILayout.EnumPopup(new GUIContent("Projection", "_Camera"), projection);
        if (EditorGUI.EndChangeCheck())
        {
            _editor.RegisterPropertyChangeUndo("Projection");
            SetKeyword(_targetMat, "_CAMERA_PERSPECTIVE", projection == CameraProjection.Perspective);
            SetKeyword(_targetMat, "_CAMERA_ORTHOGRAPHIC", projection == CameraProjection.Orthographic);
        }

        LightingType lightingType = CurrentLightingType(_targetMat);

        EditorGUI.BeginChangeCheck();
        lightingType = (LightingType)EditorGUILayout.EnumPopup(new GUIContent("Lighting", "_Lighting"), lightingType);
        if (EditorGUI.EndChangeCheck())
        {
            _editor.RegisterPropertyChangeUndo("Lighting");
            SetKeyword(_targetMat, "_LIGHTING_UNITY", lightingType == LightingType.Unity);
            SetKeyword(_targetMat, "_LIGHTING_CENTRAL", lightingType == LightingType.Central);
            SetKeyword(_targetMat, "_LIGHTING_CUSTOM", lightingType == LightingType.Custom);
        }

        if (lightingType == LightingType.Custom)
        {
            EditorGUI.indentLevel++;
            ShowShaderProperty(_editor, _properties, "Light Direction", "_LightDirection", "");
            EditorGUI.indentLevel--;
        }

        bool toggle;

        ShowToggle(_targetMat, _editor, out toggle, "Poly Liquid", "_POLYLIQUID_ON", "");
    }
예제 #11
0
 public CameraProjection GetProjectionProps() =>
 CameraProjection.Lerp(initialCamera.GetProjectionProps(), targetCamera.GetProjectionProps(), CurrentLerpAmount);
 public void OnChangeCreationState()
 {
     /* chooses the opposite camera projection and change it afterward. */
     switch (m_dropdownCreationState.value)
     {
         case 0:
             onChangeCameraProjection ();
             m_currentCreationState = CreationState.BASE;
             m_currentCameraProjection = CameraProjection.PERSPECTIVE;
             break;
         case 1 :
             m_currentCreationState = CreationState.OBJECT_CREATION;
             m_currentCameraProjection = CameraProjection.ORTHOGRAPHIC;
             break;
         case 2 :
             m_currentCreationState = CreationState.CUSTOMIZATION;
             m_currentCameraProjection = CameraProjection.ORTHOGRAPHIC;
             break;
         case 3 :
             m_currentCreationState = CreationState.VISUALIZATION;
             m_currentCameraProjection = CameraProjection.ORTHOGRAPHIC;
             break;
         default:
             break;
     }
     onChangeCameraProjection ();
 }
    public void Start()
    {
        m_currentCreationState = CreationState.VISUALIZATION;
        m_dropdownCreationState = GameObject.Find ("dropdown_creation_states").GetComponent<Dropdown>();

        m_currentCameraProjection = CameraProjection.PERSPECTIVE;
        m_cameraPerspObject = GameObject.Find ("camera_persp");
        m_cameraPersp = m_cameraPerspObject.GetComponent<Camera> ();
        m_cameraOrthoObject = GameObject.Find ("camera_ortho");
        m_cameraOrtho = m_cameraOrthoObject.GetComponent<Camera> ();
        m_cameraOrthoObject.SetActive (false);
        m_currentCamera = m_cameraPersp;
        m_currentCameraObject = m_cameraPerspObject;

        m_isTranslating = false;
        m_isRotating = false;
        m_xyTranslationSpeed = 1;
        m_zTranslationSpeed = 30;
        m_rotatingSpeed = 5;

        m_creationPanel = GameObject.Find ("panel_building_creation");
        m_canSelectObject = false;
        Shader.EnableKeyword ("_EMISSION");
        m_selectedMaterial = Resources.Load("stripes_mat", typeof(Material)) as Material;
        m_defaultWallMaterial = Resources.Load ("Default-Material", typeof(Material)) as Material;

        m_levelDisplayText = GameObject.Find ("label_level_display").GetComponent<Text>();

        m_buildingContainer = GameObject.Find ("building");
        m_building = new Dictionary<string, LinkedList<GameObject>> ();
        /*LinkedList<GameObject> list = new LinkedList<GameObject> ();
        GetAllChildrenWithTag (list, m_buildingContainer, "Construction");
        m_building.Add ("*", list);

        m_levelDisplayText.text = "*";*/
    }
예제 #14
0
 public Camera(Vector3 @angle, CameraNamedPosition? @namedPosition, CameraProjection @projection)
 {
     this.Angle         = @angle;
     this.NamedPosition = @namedPosition;
     this.Projection    = @projection;
 }