示例#1
0
 private SettingsWindow()
 {
     _userOrbitSettings = _state.UserOrbitSettings;
     _arcSegments       = _userOrbitSettings.NumberOfArcSegments;
     _maxAlpha          = _userOrbitSettings.MaxAlpha;
     _minAlpha          = _userOrbitSettings.MinAlpha;
     _colour            = Helpers.Color(_userOrbitSettings.Red, _userOrbitSettings.Grn, _userOrbitSettings.Blu);
     _flags             = ImGuiWindowFlags.AlwaysAutoResize;
     IsThreaded         = _state.Game.Settings.EnableMultiThreading;
 }
示例#2
0
        internal OrbitIcon(ref EntityState entityState, UserOrbitSettings settings) : base(entityState.Entity.GetDataBlob <PositionDB>())
        {
            entityState.OrbitIcon = this;

            _userSettings   = settings;
            _orbitDB        = entityState.Entity.GetDataBlob <OrbitDB>();
            _bodyPositionDB = entityState.Entity.GetDataBlob <PositionDB>();
            if (_orbitDB.Parent == null) //primary star
            {
                _positionDB = _bodyPositionDB;
            }
            else
            {
                _positionDB = _orbitDB.Parent.GetDataBlob <PositionDB>(); //orbit's position is parent's body position.
            }

            _orbitEllipseSemiMaj   = (float)_orbitDB.SemiMajorAxis;
            _orbitEllipseMajor     = _orbitEllipseSemiMaj * 2;
            _orbitEllipseSemiMinor = (float)EllipseMath.SemiMinorAxis(_orbitDB.SemiMajorAxis, _orbitDB.Eccentricity);
            _orbitEllipseMinor     = _orbitEllipseSemiMinor * 2;


            _linearEccentricity = (float)(_orbitDB.Eccentricity * _orbitDB.SemiMajorAxis); //linear ecentricity

            if (_orbitDB.Inclination > 90 && _orbitDB.Inclination < 270)                   //orbitDB is in degrees.
            {
                IsClockwiseOrbit   = false;
                _orbitAngleDegrees = (float)(_orbitDB.LongitudeOfAscendingNode - _orbitDB.ArgumentOfPeriapsis);
            }
            else
            {
                _orbitAngleDegrees = (float)(_orbitDB.LongitudeOfAscendingNode + _orbitDB.ArgumentOfPeriapsis);
            }
            _orbitAngleRadians = (float)(Angle.ToRadians(_orbitAngleDegrees));

            UpdateUserSettings();
            CreatePointArray();

            OnPhysicsUpdate();
        }