Beispiel #1
0
        protected virtual void RenderProgress(DrawArgs drawArgs)
        {
            drawArgs.device.Transform.World = Matrix.Translation(
                (float)-drawArgs.WorldCamera.ReferenceCenter.X,
                (float)-drawArgs.WorldCamera.ReferenceCenter.Y,
                (float)-drawArgs.WorldCamera.ReferenceCenter.Z
                );

            device.RenderState.ZBufferEnable = false;
            double centerLat = 0.5 * (maxLat + minLat);
            double centerLon = 0.5 * (maxLon + minLon);

            Vector3 v = MathEngine.SphericalToCartesian(centerLat, centerLon, this.layerRadius);

            if (drawArgs.WorldCamera.ViewFrustum.ContainsPoint(v) &&
                MathEngine.SphericalDistanceDegrees(centerLat, centerLon, drawArgs.WorldCamera.Latitude.Degrees, drawArgs.WorldCamera.Longitude.Degrees) < 2 * drawArgs.WorldCamera.ViewRange.Degrees
                )
            {
                v.Project(drawArgs.device.Viewport, drawArgs.device.Transform.Projection, drawArgs.device.Transform.View, drawArgs.device.Transform.World);

                MenuUtils.DrawBox((int)v.X, (int)v.Y, 200, 40, 0.0f, progressBarBackColor, drawArgs.device);
                Vector2[] boxOutline = new Vector2[5];
                boxOutline[0].X = (int)v.X;
                boxOutline[0].Y = (int)v.Y;

                boxOutline[1].X = (int)v.X + 200;
                boxOutline[1].Y = (int)v.Y;

                boxOutline[2].X = (int)v.X + 200;
                boxOutline[2].Y = (int)v.Y + 40;

                boxOutline[3].X = (int)v.X;
                boxOutline[3].Y = (int)v.Y + 40;

                boxOutline[4].X = (int)v.X;
                boxOutline[4].Y = (int)v.Y;

                MenuUtils.DrawLine(boxOutline, progressBarOutlineColor, drawArgs.device);

                drawArgs.defaultDrawingFont.DrawText(null,
                                                     "Downloading Remote Image...",
                                                     new System.Drawing.Rectangle((int)v.X + 5, (int)v.Y + 5, 200, 50),
                                                     DrawTextFormat.NoClip, textColor);

                DrawProgressBar(drawArgs, v.X + 100, v.Y + 30, 180, 10, World.Settings.downloadProgressColor);
            }
            device.RenderState.ZBufferEnable = true;
            drawArgs.device.Transform.World  = drawArgs.WorldCamera.WorldMatrix;
        }