Ejemplo n.º 1
0
        public string HandleTreeNodeSelected(TreeViewEventArgs e)
        {
            string pano_id, pano_name;

            if (DecipherPanoName(e.Node.Text, out pano_id, out pano_name))
            {
                dynamic args = new ExpandoObject() as dynamic;
                args.name = pano_name;
                args.id   = pano_id;

                var post_obj = new PostObjectForJS("TransitHandler", "ChangePano", args);
                return(post_obj.MakeScript());
            }

            return("");
        }
Ejemplo n.º 2
0
        public string HandleCameraChange(string type)
        {
            double angle_to_rotate = Math.PI * 15.0 / 180.0;

            dynamic args = new ExpandoObject() as dynamic;

            Quaternion q;
            Vec3       new_lookat = _camera.lookAt;
            Vec3       new_upvec  = _camera.up;
            Vec3       perp_vec   = _camera.lookAt.Cross(_camera.up);

            switch (type)
            {
            case "Left":
                q          = new Quaternion(angle_to_rotate, _camera.up);
                new_lookat = q.Rotate(_camera.lookAt);
                break;

            case "Right":
                q          = new Quaternion(-angle_to_rotate, _camera.up);
                new_lookat = q.Rotate(_camera.lookAt);
                break;

            case "Up":
                q          = new Quaternion(angle_to_rotate, perp_vec);
                new_lookat = q.Rotate(_camera.lookAt);
                new_upvec  = q.Rotate(_camera.up);
                break;

            case "Down":
                q          = new Quaternion(-angle_to_rotate, perp_vec);
                new_lookat = q.Rotate(_camera.lookAt);
                new_upvec  = q.Rotate(_camera.up);
                break;
            }

            double[] look_at = { new_lookat.x, new_lookat.y, new_lookat.z };
            double[] up_vec  = { new_upvec.x, new_upvec.y, new_upvec.z };

            args.lookat = look_at;
            args.up     = up_vec;
            var post_obj = new PostObjectForJS("Camera", "Change", args);

            return(post_obj.MakeScript());
        }