Example #1
0
        protected override void initialize()
        {
            Camera camera = this.GetComponentInChildren <Camera>() as Camera;

            shutter_edges = new GameObject[edges];

            screen_height = PlanetariaMath.cone_radius(PlanetariaCamera.near_clip_plane, camera.fieldOfView * Mathf.Deg2Rad) * 2;
            screen_width  = screen_height * camera.aspect;

            for (int edge_index = 0; edge_index < edges; ++edge_index)
            {
                shutter_edges[edge_index] = (GameObject)Instantiate(Resources.Load("BlinkShutter"),
                                                                    new Vector3(0, screen_height * Mathf.Cos(edge_index * Mathf.PI), PlanetariaCamera.near_clip_plane + Precision.tolerance),
                                                                    Quaternion.Euler(0, 0, edge_index * 180f), camera.transform);
                shutter_edges[edge_index].transform.localScale = new Vector3(screen_width, screen_height, 1);
            }
        }
        protected override void initialize()
        {
            Camera camera = this.GetComponentInChildren <Camera>() as Camera;

            shutter_edges = new GameObject[edges];

            for (int edge_index = 0; edge_index < edges; ++edge_index)
            {
                shutter_edges[edge_index] = (GameObject)Instantiate(Resources.Load("PrimaryEdge"),
                                                                    new Vector3(0, 0, 2 * PlanetariaCamera.near_clip_plane),
                                                                    Quaternion.Euler(0, 0, edge_index * 360f / edges), camera.transform);
#if UNITY_EDITOR
                shutter_edges[edge_index].transform.localScale = Vector3.one * 4 * PlanetariaMath.cone_radius(2 * PlanetariaCamera.near_clip_plane, camera.fieldOfView * Mathf.Deg2Rad) * Mathf.Sqrt(1 + (camera.aspect * camera.aspect));
#else
                float x = PlanetariaMath.cone_radius(2 * PlanetariaCamera.near_clip_plane, camera.fieldOfView * Mathf.Deg2Rad);
                float y = x * camera.aspect;
                float z = 2 * PlanetariaCamera.near_clip_plane;

                StereoscopicProjectionCoordinates stereoscopic_projection = new NormalizedCartesianCoordinates(new Vector3(x, y, z));

                shutter_edges[edge_index].transform.localScale = Vector3.one * stereoscopic_projection.data.magnitude; // FIXME: VR FOV
#endif
            }
        }