Exemple #1
0
        private void RenderConstName(GlobeOverlay overlay, Vector3 xyz, Vector2 labelScale, Color4 c)
        {
            if (overlay.Font != null && !string.IsNullOrWhiteSpace(overlay.Label))
            {
                GL.Disable(All.Lighting);
                GL.BlendFunc(All.SrcAlpha, All.OneMinusSrcAlpha);
                GL.Enable(All.Blend);

                overlay.Font.Color = c;
                overlay.Font.Scale = labelScale;

                int length = overlay.Font.MeasureString(overlay.Label);
                float centeredX = xyz.X - (length / 2F);
                float centeredY = xyz.Y + (overlay.Font.LineHeight / 2F);
                overlay.Font.PrintAt(overlay.Label, centeredX, centeredY, xyz.Z);
            }
        }
        private void CreateOverlays(int mFlareSource, TexFont texFont)
        {
            // zero
            var overlay = new GlobeOverlay
                {
                    Position = this.engine.Planet.GetGeoCoord(0, 0),
                    Label = "Zero",
                    DotTexture = mFlareSource,
                    Font = texFont
                };
            this.engine.Planet.Overlays.Add(overlay);

            // melborne : 37.7833° S, 144.9667° E
            overlay = new GlobeOverlay
                {
                    Position = this.engine.Planet.GetGeoCoord(-144.9667F, -37.7833F),
                    Label = "Melborne",
                    DotTexture = mFlareSource,
                    Font = texFont
                };
            this.engine.Planet.Overlays.Add(overlay);

            // capeTown : 33.9767° S, 18.4244° E
            overlay = new GlobeOverlay
                {
                    Position = this.engine.Planet.GetGeoCoord(-18.4244F, -33.9767F),
                    Label = "Cape Town",
                    DotTexture = mFlareSource,
                    Font = texFont
                };
            this.engine.Planet.Overlays.Add(overlay);

            // egypt 30.0100° N, 31.2100° E
            overlay = new GlobeOverlay
                {
                    Position = this.engine.Planet.GetGeoCoord(-31.2100F, 30.0100F),
                    Label = "Egypt",
                    DotTexture = mFlareSource,
                    Font = texFont
                };
            this.engine.Planet.Overlays.Add(overlay);

            // newYork : 40.7142° N, 74.0064° W
            overlay = new GlobeOverlay
                {
                    Position = this.engine.Planet.GetGeoCoord(74.0064F, 40.7142F),
                    Label = "New York",
                    DotTexture = mFlareSource,
                    Font = texFont
                };
            this.engine.Planet.Overlays.Add(overlay);
        }
Exemple #3
0
        private void ExecuteOverlay(GlobeOverlay overlay, Vector2 windowSize, float size)
        {
            Vector3 screenLoc = MiniGlu.GetScreenLocation(overlay.Position);
            if (screenLoc.Z <= -this.Position.Z)
            {
                float x = screenLoc.X - windowSize.X / 2F;
                float y = screenLoc.Y - windowSize.Y / 2F;
                float z = Math.Abs(this.Position.Z + screenLoc.Z);

                var dotScale = DrawScale(size, overlay.DotScale, z);
                var dotPos = new Vector2(x, -y);
                Utils.RenderTextureAt(dotPos, windowSize, overlay.DotTexture, dotScale, overlay.DotColor);

                var labelScale = DrawScale(size, overlay.LabelScale, z);
                var textPos = new Vector3(screenLoc.X, windowSize.Y - screenLoc.Y, this.Position.Z);
                this.RenderConstName(overlay, textPos, labelScale, overlay.LabelColor);
            }
        }