public SunlitLTree(Game game, ICameraProvider cameraProvider, SunlightParameters sky, Vector3 position)
     : base(game)
 {
     _cameraProvider = cameraProvider;
     _sky = sky;
     _position = position;
     Content = game.Content;
 }
        public void Update(ICamera camera, SunlightParameters sunlightParameters)
        {
            View       = camera.View;
            Projection = camera.Projection;

            if (sunlightParameters != null)
            {
                LightColor        = sunlightParameters.LightColor;
                LightColorAmbient = sunlightParameters.LightColorAmbient;
                LightDirection    = sunlightParameters.LightDirection;
                FogDensity        = sunlightParameters.FogDensity;

                LightColorAmbient = sunlightParameters.LightColorAmbient;
                LightColor        = sunlightParameters.LightColor;
                LightDirection    = sunlightParameters.LightDirection;

                HazeTopAltitude           = sunlightParameters.HazeTopAltitude;
                DayToSunsetSharpness      = sunlightParameters.DayToSunsetSharpness;
                LargeSunRadiusAttenuation = sunlightParameters.LargeSunRadiusAttenuation;
                LargeSunLightness         = sunlightParameters.LargeSunLightness;
                SunRadiusAttenuation      = sunlightParameters.SunRadiusAttenuation;
                SunLightness = sunlightParameters.SunLightness;
            }

            ApplyParameters();
        }
예제 #3
0
        public SkydomeComponent(Game game, ICameraProvider cameraProvider) : base(game)
        {
            _cameraProvider = cameraProvider;
            _game           = game;

            _realTime              = false;
            _parameters            = new SunlightParameters();
            _parameters.FogDensity = 0.0058f;
        }
        public SkydomeComponent(Game game, ICameraProvider cameraProvider)
            : base(game)
        {
            _cameraProvider = cameraProvider;
            _game = game;

            _realTime = false;
            _parameters = new SunlightParameters();
            _parameters.FogDensity = 0.0058f;
        }
        public Forest(Game game, ICameraProvider cameraProvider, TerrainMesh terrain, SunlightParameters sky)
            : base(game)
        {
            if (game == null || cameraProvider == null || terrain == null)
                throw new ArgumentNullException();

            _game = game;
            _cameraProvider = cameraProvider;
            _terrain = terrain;
            _sky = sky;
            _treePositions = new List<Vector3>();
        }
        //, Vector3 position)
        public TerrainComponent(Game game, ICameraProvider cameraProvider, SunlightParameters sunParams)
            : base(game)
        {
            if (game == null) throw new ArgumentNullException("game");
            if (sunParams == null) throw new ArgumentNullException("sunParams");
            if (cameraProvider == null) throw new ArgumentNullException("cameraProvider");

            _cameraProvider = cameraProvider;
            _sunParams = sunParams;

            _content = new ContentManager(Game.Services);

            //            Position = position;  position does not have a function at the moment
            //            TerrainMeshes = new List<TerrainMesh>();
        }
        public SimpleModel(string modelName, Game game, ICameraProvider cameraProvider, SunlightParameters skyParams)
            : base(game)
        {
            _modelName = modelName;
            _cameraProvider = cameraProvider;
            _skyParams = skyParams;

            _fbxImportScale = Matrix.CreateScale(0.01f);

            // TODO Apply transformations to these later if they become needed
            CameraUp = Vector3.Up;
            CameraForward = Vector3.Forward;

            // Initial render transformation
            Position = Vector3.Zero;
            Rotation = Matrix.Identity;
            Scale = Matrix.Identity;

            IsTransparent = false;
            IsTwoSided = false;
            IsSelfLit = false;
        }
        public HelicopterBase(Game game, TestConfiguration testConfiguration, TerrainCollision collision, 
            ICameraProvider cameraProvider, BasicEffect effect, SunlightParameters skyParams, HelicopterScenario scenario, 
            bool playEngineSound, bool isPlayerControlled, bool drawText)
            : base(game)
        {
            if (game == null || cameraProvider == null || effect == null || skyParams == null)
                throw new ArgumentNullException("", @"One or several of the necessary arguments were null!");

            

            _game = game;
            _testConfiguration = testConfiguration;
            _sensorSpecifications = testConfiguration.Sensors;
            _collision = collision;
            _flyBySensors = testConfiguration.FlyBySensors;

            if (_collision != null)
                _collision.CollidedWithTerrain += gameTime => Crashed(gameTime);
                

            _basicEffect = effect;
            _skyParams = skyParams;
            _scenario = scenario;
            _drawText = drawText;
            _cameraProvider = cameraProvider;
            IsPlayerControlled = isPlayerControlled;

            _playEngineSound = playEngineSound;

            _estimatedState = new HeliState();

            PIDSetup pidSetup = SimulatorResources.GetPIDSetups()[0];
            Autopilot = new Autopilot(_scenario.Task, pidSetup);
            Log = new List<HelicopterLogSnapshot>();
        }
        private void InitHelicopters(SunlightParameters skyParameters, NavigationMap heightmap)
        {
            // TODO 1 or more helicopters?
            if (_scenario.HelicopterScenarios == null || _scenario.HelicopterScenarios.Count == 0)
                throw new Exception("Could not find helicopter scenario.");

            HelicopterScenario heliScenario = _scenario.HelicopterScenarios[0];

            var startVelocity = new Vector3(); //new Vector3(-0.5f, 0, -1.0f)
            var startState = new PhysicalHeliState(
                Quaternion.Identity,
                heliScenario.StartPosition,
                startVelocity,
                Vector3.Zero);

            
            _helicopter = new HelicopterBase(this, _testConfiguration, _terrainCollision, this, _basicEffect, skyParameters, heliScenario, 
                                             heliScenario.EngineSound, heliScenario.PlayerControlled, DrawText);


            // If testing then we will continue to the next waypoint as soon as the true position is within
            // the radius of the waypoint. If not testing (non-simulated scenarios), we typically want to
            // progress only if the estimated state is belived to be within the radius.
            _helicopter.Autopilot.IsTestMode = IsTestMode;
            _helicopter.Autopilot.IsTruePositionWithinRadius = false;

            _helicopter.Autopilot.MaxHVelocity = _testMaxHVelocityIter.Current;

            // Optionally a PID setup may have been provided to use with the helicopters.
            // If not a default setup is used.
            if (_initialPIDSetup.HasValue)
                SetPIDSetup(_initialPIDSetup.Value);

            //            InitFormationHelicopters(startPos, skyParameters);

            _helicopter.Autopilot.Map = heightmap;
        }
        public void Update(ICamera camera, SunlightParameters sunlightParameters)
        {
            View = camera.View;
            Projection = camera.Projection;

            if (sunlightParameters != null)
            {
                LightColor = sunlightParameters.LightColor;
                LightColorAmbient = sunlightParameters.LightColorAmbient;
                LightDirection = sunlightParameters.LightDirection;
                FogDensity = sunlightParameters.FogDensity;

                LightColorAmbient = sunlightParameters.LightColorAmbient;
                LightColor = sunlightParameters.LightColor;
                LightDirection = sunlightParameters.LightDirection;

                HazeTopAltitude = sunlightParameters.HazeTopAltitude;
                DayToSunsetSharpness = sunlightParameters.DayToSunsetSharpness;
                LargeSunRadiusAttenuation = sunlightParameters.LargeSunRadiusAttenuation;
                LargeSunLightness = sunlightParameters.LargeSunLightness;
                SunRadiusAttenuation = sunlightParameters.SunRadiusAttenuation;
                SunLightness = sunlightParameters.SunLightness;
            }

            ApplyParameters();
        }