public SunlitLTree(Game game, ICameraProvider cameraProvider, SunlightParameters sky, Vector3 position)
     : base(game)
 {
     _cameraProvider = cameraProvider;
     _sky            = sky;
     _position       = position;
     Content         = game.Content;
 }
        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>();
        }
    void CreateSunlight()
    {
        if (sunlight == null)
        {
            sunlight = new GameObject("DirectionalLight");
            //Init defaults
            sunlightParameters = new SunlightParameters();
            sunlightParameters.lightParameters.type = LightType.Directional;
        }

        sunlight.transform.parent        = sunlightTimeofdayDummy.transform;
        sunlight.transform.localPosition = -Vector3.forward * gizmoSize;

        directionalLight    = sunlight.GetComponent <Light>() ?? sunlight.AddComponent <Light>();
        additionalLightData = sunlight.GetComponent <HDAdditionalLightData>() ?? sunlight.AddComponent <HDAdditionalLightData>();
        shadowData          = sunlight.GetComponent <AdditionalShadowData>() ?? sunlight.AddComponent <AdditionalShadowData>();

        directionalLight.type = LightType.Directional;
    }
        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>();
        }
    // Called each frame the mixer is active, after inputs are processed
    public override void ProcessFrame(Playable handle, FrameData info, object playerData)
    {
        Volume             volume        = playerData as Volume;
        VolumeProfile      volumeProfile = Application.isPlaying ? volume.profile : volume.sharedProfile;
        SunlightProperties sunprops      = ScriptableObject.CreateInstance <SunlightProperties>();

        SunlightParameters neutralSunlightParameters = new SunlightParameters(true);
        SunlightParameters mixedSunlightParameters   = new SunlightParameters(true);

        if (volumeProfile.TryGet <SunlightProperties>(out sunprops))
        {
            var count = handle.GetInputCount();
            for (var i = 0; i < count; i++)
            {
                var inputHandle = handle.GetInput(i);
                var weight      = handle.GetInputWeight(i);

                if (inputHandle.IsValid() &&
                    inputHandle.GetPlayState() == PlayState.Playing &&
                    weight > 0)
                {
                    var data = ((ScriptPlayable <SunlightClipPlayable>)inputHandle).GetBehaviour();
                    if (data != null)
                    {
                        var weightedSunlightParameters = SunlightLightingUtilities.LerpSunlightParameters(neutralSunlightParameters, data.sunlightParameters, weight);

                        mixedSunlightParameters += weightedSunlightParameters;
                    }
                }
            }

            sunprops.YAxis.value         = mixedSunlightParameters.orientationParameters.yAxis;
            sunprops.lattitude.value     = mixedSunlightParameters.orientationParameters.lattitude;
            sunprops.timeOfDay.value     = mixedSunlightParameters.orientationParameters.timeOfDay;
            sunprops.intensity.value     = mixedSunlightParameters.lightParameters.intensity;
            sunprops.color.value         = mixedSunlightParameters.lightParameters.colorFilter;
            sunprops.cookieTexture.value = mixedSunlightParameters.lightParameters.lightCookie;
            sunprops.cookieSize.value    = mixedSunlightParameters.lightParameters.cookieSize;
        }
    }
示例#6
0
        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;
        }
示例#7
0
        public TerrainComponent(Game game, ICameraProvider cameraProvider, SunlightParameters sunParams)//, Vector3 position)
            : 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>();
        }