Ejemplo n.º 1
0
        internal static Overlay FromXml(TourStop owner, XmlNode overlay)
        {
            if (overlay.Attributes == null)
            {
                return(null);
            }

            if (overlay.Attributes.GetNamedItem("Type") == null)
            {
                return(null);
            }
            string overlayClassName = overlay.Attributes.GetNamedItem("Type").Value.ToString();

            //Type overLayType = Type.GetType(overlayClassName.Replace("TerraViewer.",""));
            string  overLayType = overlayClassName.Replace("TerraViewer.", "");
            Overlay newOverlay  = null;

            //Overlay newOverlay = (Overlay)System.Activator.CreateInstance(overLayType);
            switch (overLayType)
            {
            case "AudioOverlay":
                newOverlay = new AudioOverlay();
                break;

            case "BitmapOverlay":
                newOverlay = new BitmapOverlay();
                break;

            case "FlipBookOverlay":
                newOverlay = new FlipbookOverlay();
                break;

            case "ShapeOverlay":
                newOverlay = new ShapeOverlay();
                break;

            case "TextOverlay":
                newOverlay = new TextOverlay();
                break;

            default:
                return(null);
            }

            newOverlay.owner = owner;
            newOverlay.InitOverlayFromXml(overlay);
            return(newOverlay);
        }
Ejemplo n.º 2
0
        public void Render(RenderContext renderContext)
        {
            //window.SetupMatricesOverlays();
            if (tour == null || tour.CurrentTourStop == null || !playing)
            {
                return;
            }

            renderContext.Save();

            UpdateSlideStates();

            if (!onTarget)
            {
                slideStartTime = Date.Now;
                if (renderContext.OnTarget(Tour.CurrentTourStop.Target))
                {
                    onTarget                 = true;
                    overlayBlend.State       = !Tour.CurrentTourStop.FadeInOverlays;
                    overlayBlend.TargetState = true;
                    if (tour.CurrentTourStop.MusicTrack != null)
                    {
                        tour.CurrentTourStop.MusicTrack.Play();
                    }

                    if (tour.CurrentTourStop.VoiceTrack != null)
                    {
                        tour.CurrentTourStop.VoiceTrack.Play();
                    }
                    string caption = "";
                    foreach (Overlay overlay in tour.CurrentTourStop.Overlays)
                    {
                        if (overlay.Name.ToLowerCase() == "caption")
                        {
                            TextOverlay text = overlay as TextOverlay;
                            if (text != null)
                            {
                                caption = text.TextObject.Text;
                            }
                        }
                        overlay.Play();
                    }

                    LayerManager.SetVisibleLayerList(tour.CurrentTourStop.Layers);

                    if (tour.CurrentTourStop.EndTarget != null && tour.CurrentTourStop.EndTarget.ZoomLevel != -1)
                    {
                        if (tour.CurrentTourStop.Target.Type == ImageSetType.SolarSystem)
                        {
                            // TODO fix this when Planets are implenented
                            //tour.CurrentTourStop.Target.UpdatePlanetLocation(SpaceTimeController.UtcToJulian(tour.CurrentTourStop.StartTime));
                            //tour.CurrentTourStop.EndTarget.UpdatePlanetLocation(SpaceTimeController.UtcToJulian(tour.CurrentTourStop.EndTime));
                        }
                        renderContext.ViewMover = new ViewMoverKenBurnsStyle(tour.CurrentTourStop.Target.CamParams, tour.CurrentTourStop.EndTarget.CamParams, tour.CurrentTourStop.Duration / 1000.0, tour.CurrentTourStop.StartTime, tour.CurrentTourStop.EndTime, tour.CurrentTourStop.InterpolationType);
                    }
                    Settings.TourSettings           = tour.CurrentTourStop;
                    SpaceTimeController.Now         = tour.CurrentTourStop.StartTime;
                    SpaceTimeController.SyncToClock = false;

                    WWTControl.scriptInterface.FireSlideChanged(caption);
                }
            }

            //todo implement gl based tour rendering
            if (renderContext.gl != null)
            {
                renderContext.SetupMatricesOverlays();

                //todo Factor opacity in somehow ??
                //view.overlays.Opacity = overlayBlend.Opacity;

                if (currentMasterSlide != null)
                {
                    foreach (Overlay overlay in currentMasterSlide.Overlays)
                    {
                        overlay.TweenFactor = 1f;
                        overlay.Draw3D(renderContext, false);
                    }
                }

                if (onTarget)
                {
                    foreach (Overlay overlay in tour.CurrentTourStop.Overlays)
                    {
                        if (overlay.Name.ToLowerCase() != "caption" || WWTControl.scriptInterface.ShowCaptions)
                        {
                            overlay.TweenFactor = (float)CameraParameters.EaseCurve(tour.CurrentTourStop.TweenPosition, overlay.InterpolationType == InterpolationType.DefaultV ? tour.CurrentTourStop.InterpolationType : overlay.InterpolationType);
                            overlay.Draw3D(renderContext, false);
                        }
                    }
                }


                renderContext.Restore();

                //DrawPlayerControls(renderContext);
            }
            else
            {
                renderContext.Device.Scale(renderContext.Height / 1116, renderContext.Height / 1116);

                double aspectOrig = 1920 / 1116;

                double aspectNow = renderContext.Width / renderContext.Height;

                renderContext.Device.Translate(-((1920 - (aspectNow * 1116)) / 2), 0);

                //todo Factor opacity in somehow ??
                //view.overlays.Opacity = overlayBlend.Opacity;


                if (currentMasterSlide != null)
                {
                    foreach (Overlay overlay in currentMasterSlide.Overlays)
                    {
                        overlay.TweenFactor = 1f;
                        overlay.Draw3D(renderContext, false);
                    }
                }

                if (onTarget)
                {
                    foreach (Overlay overlay in tour.CurrentTourStop.Overlays)
                    {
                        if (overlay.Name.ToLowerCase() != "caption" || WWTControl.scriptInterface.ShowCaptions)
                        {
                            overlay.TweenFactor = (float)CameraParameters.EaseCurve(tour.CurrentTourStop.TweenPosition, overlay.InterpolationType == InterpolationType.DefaultV ? tour.CurrentTourStop.InterpolationType : overlay.InterpolationType);
                            overlay.Draw3D(renderContext, false);
                        }
                    }
                }
                else
                {
                    int i = 0;
                }
                renderContext.Restore();

                DrawPlayerControls(renderContext);
            }
        }
Ejemplo n.º 3
0
        internal static Overlay FromXml(TourStop owner, XmlNode overlay)
        {
            if (overlay.Attributes == null)
            {
                return null;
            }

            if (overlay.Attributes.GetNamedItem("Type") == null)
            {
                return null;
            }
            string overlayClassName = overlay.Attributes.GetNamedItem("Type").Value.ToString();

            //Type overLayType = Type.GetType(overlayClassName.Replace("TerraViewer.",""));
            string overLayType = overlayClassName.Replace("TerraViewer.", "");
            Overlay newOverlay = null;

            //Overlay newOverlay = (Overlay)System.Activator.CreateInstance(overLayType);
            switch (overLayType)
            {
                case "AudioOverlay":
                    newOverlay = new AudioOverlay();
                    break;
                case "BitmapOverlay":
                    newOverlay = new BitmapOverlay();
                    break;
                case "FlipBookOverlay":
                    newOverlay = new FlipbookOverlay();
                    break;
                case "ShapeOverlay":
                    newOverlay = new ShapeOverlay();
                    break;
                case "TextOverlay":
                    newOverlay = new TextOverlay();
                    break;
                default:
                    return null;
            }

            newOverlay.owner = owner;
            newOverlay.InitOverlayFromXml(overlay);
            return newOverlay;
        }