Example #1
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            // Setup camera script
            var camera = SceneSystem.SceneInstance.First(x => x.Name == "Camera");

            if (camera != null)
            {
                var cameraScript = new FpsTestCamera();
                camera.Add(cameraScript);
            }

            SetupLighting?.Invoke(this);

            // Setup lights
            SceneSystem.SceneInstance.First(x => x.Name == nameof(AmbientLight)).Get <LightComponent>().Enabled     = AmbientLight;
            SceneSystem.SceneInstance.First(x => x.Name == nameof(PointLight)).Get <LightComponent>().Enabled       = PointLight;
            SceneSystem.SceneInstance.First(x => x.Name == nameof(SpotLight)).Get <LightComponent>().Enabled        = SpotLight;
            SceneSystem.SceneInstance.First(x => x.Name == nameof(SpotLightShadow)).Get <LightComponent>().Enabled  = SpotLightShadow;
            SceneSystem.SceneInstance.First(x => x.Name == nameof(DirectionalLight)).Get <LightComponent>().Enabled = DirectionalLight;
            SceneSystem.SceneInstance.First(x => x.Name == nameof(DirectionalLightShadowOneCascade)).Get <LightComponent>().Enabled    = DirectionalLightShadowOneCascade;
            SceneSystem.SceneInstance.First(x => x.Name == nameof(DirectionalLightShadowOneCascade2)).Get <LightComponent>().Enabled   = DirectionalLightShadowOneCascade2;
            SceneSystem.SceneInstance.First(x => x.Name == nameof(DirectionalLightShadowFourCascades)).Get <LightComponent>().Enabled  = DirectionalLightShadowFourCascades;
            SceneSystem.SceneInstance.First(x => x.Name == nameof(DirectionalLightShadowOneCascadePCF)).Get <LightComponent>().Enabled = DirectionalLightShadowOneCascadePCF;
            SceneSystem.SceneInstance.First(x => x.Name == nameof(Skybox)).Get <LightComponent>().Enabled        = Skybox;
            SceneSystem.SceneInstance.First(x => x.Name == nameof(SkyboxRotated)).Get <LightComponent>().Enabled = SkyboxRotated;
        }
Example #2
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            var cube   = SceneSystem.SceneInstance.First(x => x.Name == "Cube");
            var sphere = SceneSystem.SceneInstance.First(x => x.Name == "Sphere");

            var camera = SceneSystem.SceneInstance.First(x => x.Name == "Camera");

            if (camera != null)
            {
                var cameraScript = new FpsTestCamera();
                camera.Add(cameraScript);
            }

            var material = createMaterial(this);

            // Apply it on both cube and sphere
            cube.Get <ModelComponent>().Model.Materials[0]   = material;
            sphere.Get <ModelComponent>().Model.Materials[0] = material;
        }