Exemple #1
0
        // ** Begin
        public static void DrawMPC3D(RenderContext renderContext, float opacity, Vector3d centerPoint)
        {
            double zoom      = renderContext.ViewCamera.Zoom;
            double distAlpha = ((Math.Log(Math.Max(1, zoom)) / Math.Log(4)) - 15.5) * 90;

            int alpha = Math.Min(255, Math.Max(0, (int)distAlpha));



            if (alpha > 254)
            {
                return;
            }


            if (mpcVertexBuffer == null)
            {
                if (starTexture == null)
                {
                    starTexture = Planets.LoadPlanetTexture(URLHelpers.singleton.engineAssetUrl("StarProfileAlpha.png"));
                }
                for (int i = 0; i < 7; i++)
                {
                    mpcBlendStates[i] = BlendState.Create(false, 1000);
                }

                if (!initBegun)
                {
                    StartInit();
                    initBegun = true;
                }
                return;
            }

            Matrix3d offset   = Matrix3d.Translation(Vector3d.Negate(centerPoint));
            Matrix3d world    = Matrix3d.MultiplyMatrix(renderContext.World, offset);
            Matrix3d matrixWV = Matrix3d.MultiplyMatrix(world, renderContext.View);

            Vector3d cam = Vector3d.TransformCoordinate(renderContext.CameraPosition, Matrix3d.InvertMatrix(renderContext.World));

            //todo star profile texture

            if (mpcVertexBuffer != null)
            {
                for (int i = 0; i < 7; i++)
                {
                    // mpcBlendStates[i].TargetState = ((Properties.Settings.Default.MinorPlanetsFilter & (int)Math.Pow(2, i)) != 0);
                    mpcBlendStates[i].TargetState = true;

                    if (mpcBlendStates[i].State)
                    {
                        KeplerPointSpriteShader.Use(renderContext, matrixWV, mpcVertexBuffer[i].VertexBuffer, starTexture.Texture2d, Colors.White,
                                                    opacity * mpcBlendStates[i].Opacity, false,
                                                    (float)(SpaceTimeController.JNow - KeplerVertex.baseDate), 0, renderContext.CameraPosition, 200f, .1f);

                        renderContext.gl.drawArrays(GL.POINTS, 0, mpcVertexBuffer[i].Count);
                    }
                }
            }
        }
Exemple #2
0
 public Tile()
 {
     renderChildPart = new BlendState[4];
     for (int i = 0; i < 4; i++)
     {
         renderChildPart[i] = BlendState.Create(false, 500);
     }
 }
        static void CentroidsReady(string file)
        {
            ConstellationCentroids = new Dictionary <string, Place>();
            FullNames     = new Dictionary <string, string>();
            Abbreviations = new Dictionary <string, string>();
            BitIDs        = new Dictionary <string, int>();
            string[] rows = file.Split("\r\n");
            int      id   = 0;
            string   line;

            foreach (string row in rows)
            {
                line = row;
                string[] data = line.Split(",");
                FullNames[data[1]]              = data[0];
                Abbreviations[data[0]]          = data[1];
                BitIDs[data[1]]                 = id++;
                PictureBlendStates[data[1]]     = BlendState.Create(true, 1000);
                ConstellationCentroids[data[1]] = Place.Create(data[0], double.Parse(data[3]), double.Parse(data[2]), Classification.Constellation, data[1], ImageSetType.Sky, 360);
            }
            WWTControl.RenderNeeded = true;
            ConstellationFilter.BuildConstellationFilters();
        }