Beispiel #1
0
        public override void RenderGdi(Graphics graphics, RectangleD cameraBounds)
        {
            base.RenderGdi(graphics, cameraBounds);

            _leftFairing.RenderGdi(graphics, cameraBounds);
            _rightFairing.RenderGdi(graphics, cameraBounds);

            if (Settings.Default.WriteCsv && (DateTime.Now - timestamp > TimeSpan.FromSeconds(1)))
            {
                string filename = MissionName + ".csv";

                if (!File.Exists(filename))
                {
                    File.AppendAllText(filename, "Velocity, Acceleration, Altitude, Throttle\r\n");
                }

                timestamp = DateTime.Now;

                string contents = string.Format("{0}, {1}, {2}, {3}\r\n",
                                                this.GetRelativeVelocity().Length(),
                                                this.GetRelativeAcceleration().Length() * 100,
                                                this.GetRelativeAltitude() / 100,
                                                this.Throttle * 10);
                File.AppendAllText(filename, contents);
            }
        }
Beispiel #2
0
        public override void RenderGdi(Graphics graphics, Camera camera)
        {
            base.RenderGdi(graphics, camera);

            _leftFairing.RenderGdi(graphics, camera);
            _rightFairing.RenderGdi(graphics, camera);

            if (Settings.Default.WriteCsv && (DateTime.Now - timestamp > TimeSpan.FromSeconds(1)))
            {
                string filename = MissionName + ".csv";

                if (!File.Exists(filename))
                {
                    File.AppendAllText(filename, "Velocity, Acceleration, Altitude, Throttle, Downrange\r\n");
                }

                timestamp = DateTime.Now;

                //{ { -99014944588.2743,-109869666553.046} }
                //{ { -99015072098.6158,-109869554508.308}}

                string contents = string.Format("{0}, {1}, {2}, {3}, {4}\r\n",
                                                this.GetRelativeVelocity().Length(),
                                                this.GetRelativeAcceleration().Length() * 100,
                                                this.GetRelativeAltitude() / 100,
                                                this.Throttle * 10,
                                                this.GetDownrangeDistance(new DVector2(-99015072098.6158, -109869554508.308)) / 100);
                File.AppendAllText(filename, contents);
            }
        }
Beispiel #3
0
        public override void RenderGdi(Graphics graphics, Camera camera)
        {
            base.RenderGdi(graphics, camera);

            _leftFairing.RenderGdi(graphics, camera);
            _rightFairing.RenderGdi(graphics, camera);

            if (Settings.Default.WriteCsv && (DateTime.Now - timestamp > TimeSpan.FromSeconds(1.17)))
            {
                string filename = MissionName + ".csv";

                if (!File.Exists(filename))
                {
                    //File.AppendAllText(filename, "Velocity (m/s), Acceleration (cm/s²), Altitude (hm), Throttle (‰), Heating rate (daW/m²), Dynamic pressure (daPa)\r\n");
                    File.AppendAllText(filename, "Velocity (m/s), Acceleration (cm/s²), Altitude (hm), Throttle (‰), Lateral Acceleration (cm/s²), Heating rate (daW/m²), Dynamic pressure (daPa)\r\n");
                }

                timestamp = DateTime.Now;

                double density         = this.GravitationalParent.GetAtmosphericDensity(this.GetRelativeAltitude());
                double velocity        = this.GetRelativeVelocity().Length();
                double dynamicPressure = 0.5 * density * velocity * velocity;

                //string contents = string.Format("{0}, {1}, {2}, {3}, {4}, {5}\r\n",
                string contents = string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}\r\n",
                                                this.GetRelativeVelocity().Length(),
                                                this.GetRelativeAcceleration().Length() * 100,
                                                this.GetRelativeAltitude() / 100,
                                                //this.GetRelativeAltitude() / 1000,
                                                this.Throttle * 10,
                                                this.GetLateralAcceleration().Length() * 100,
                                                this.HeatingRate / 10,
                                                dynamicPressure / 10);
                File.AppendAllText(filename, contents);
            }
        }
Beispiel #4
0
        protected override void RenderShip(Graphics graphics, Camera camera, RectangleF screenBounds)
        {
            double drawingRotation = Pitch + Math.PI * 0.5;

            var offset = new PointF(screenBounds.X + screenBounds.Width * 0.5f,
                                    screenBounds.Y + screenBounds.Height * 0.5f);

            camera.ApplyScreenRotation(graphics);
            camera.ApplyRotationMatrix(graphics, offset, drawingRotation);

            // Normalize the angle to [0,360]
            int rollAngle = (int)(Roll * MathHelper.RadiansToDegrees) % 360;

            int heatingRate = Math.Min((int)this.HeatingRate, 600000);

            if (heatingRate > 100000)
            {
                Random     rnd        = new Random();
                float      noise      = (float)rnd.NextDouble();
                float      width      = screenBounds.Width / (3 + noise);
                float      height     = screenBounds.Height / (18 + noise);
                RectangleF plasmaRect = screenBounds;
                plasmaRect.Inflate(new SizeF(width, height));

                if (Roll != 0)
                {
                    float foreshortening = (float)Math.Pow(Math.Cos(Roll), 0.4);
                    plasmaRect.Y      += plasmaRect.Height * (1 - foreshortening);
                    plasmaRect.Height *= foreshortening;
                }

                int   alpha = 255;
                int   blue  = Math.Min(heatingRate / 2000, 255);
                int   green = 0;
                int   red   = Math.Max(blue - 64, 0);
                Color glow  = Color.FromArgb(alpha, red, green, blue);

                float penWidth = width / 12;
                Pen   glowPen  = new Pen(glow, penWidth);
                glowPen.StartCap = System.Drawing.Drawing2D.LineCap.Round;
                glowPen.EndCap   = System.Drawing.Drawing2D.LineCap.Round;
                graphics.DrawArc(glowPen, plasmaRect, 220, 100);

                glowPen.Color = Color.FromArgb((int)(alpha * 0.75), glow);
                plasmaRect.Inflate(-penWidth, -penWidth);
                graphics.DrawArc(glowPen, plasmaRect, 200, 140);

                glowPen.Color = Color.FromArgb((int)(alpha * 0.5), glow);
                plasmaRect.Inflate(-penWidth, -penWidth);
                graphics.DrawArc(glowPen, plasmaRect, 180, 180);

                glowPen.Color = Color.FromArgb((int)(alpha * 0.25), glow);
                plasmaRect.Inflate(-penWidth, -penWidth);
                graphics.DrawArc(glowPen, plasmaRect, 160, 220);
            }

            graphics.DrawImage(this.Texture, screenBounds.X, screenBounds.Y, screenBounds.Width, screenBounds.Height);

            // Index into the sprite
            //int ships = _spriteSheet.Cols * _spriteSheet.Rows;
            //int spriteIndex = (rollAngle * ships) / 360;
            //while (spriteIndex < 0)
            //    spriteIndex += ships;

            //_spriteSheet.Draw(spriteIndex, graphics, screenBounds);

            graphics.ResetTransform();

            _leftFairing.RenderGdi(graphics, camera);
            _rightFairing.RenderGdi(graphics, camera);

            if (Settings.Default.WriteCsv && (DateTime.Now - timestamp > TimeSpan.FromSeconds(1)))
            {
                string filename = MissionName + ".csv";

                if (!File.Exists(filename))
                {
                    File.AppendAllText(filename, "Velocity, Acceleration, Altitude, Throttle, Pressure, Heating\r\n");
                }

                timestamp = DateTime.Now;

                double targetVelocity  = this.GetRelativeVelocity().Length();
                double density         = this.GravitationalParent.GetAtmosphericDensity(this.GetRelativeAltitude());
                double dynamicPressure = 0.5 * density * targetVelocity * targetVelocity;

                string contents = string.Format("{0}, {1}, {2}, {3}, {4}, {5}\r\n",
                                                targetVelocity,
                                                this.GetRelativeAcceleration().Length() * 100,
                                                this.GetRelativeAltitude() / 100,
                                                this.Throttle * 10,
                                                dynamicPressure / 10,
                                                this.HeatingRate / 10);

                File.AppendAllText(filename, contents);
            }
        }