private void SetupScene() { graphicsCompositor = new SceneGraphicsCompositorLayers { Cameras = { Camera.Get <CameraComponent>() }, Master = { Renderers = { new ClearRenderFrameRenderer { Color = Color.Green, Name = "Clear frame" }, //new SceneCameraRenderer { Mode = new CameraRendererModeForward { Name = "Camera renderer", ModelEffect = "XenkoForwardShadingEffect" } }, new SceneCameraRenderer { Mode = new CameraRendererModeForward{ Name = "Camera renderer" } }, } } }; Scene = new Scene { Settings = { GraphicsCompositor = graphicsCompositor } }; Scene.Entities.Add(Camera); //var ambientLight = new Entity { new LightComponent { Type = new LightAmbient { Color = new ColorRgbProvider(Color.White) }, Intensity = 1 } }; ////var ambientLight = new Entity { new LightComponent { Type = new LightDirectional { Color = new ColorRgbProvider(Color.White) }, Intensity = 1 } }; ////ambientLight.Transform.RotationEulerXYZ = new Vector3(0.0f, (float) Math.PI, 0.0f); //Scene.Entities.Add(ambientLight); var directionalLight = new Entity { new LightComponent { Type = new LightDirectional { Color = new ColorRgbProvider(Color.White), Shadow = { Enabled = true } }, Intensity = 1 }, }; Scene.Entities.Add(directionalLight); //var directionalLight2 = new Entity { new LightComponent { Type = new LightSpot { Range = 25, Color = new ColorRgbProvider(Color.White), Shadow = { Enabled = false } }, Intensity = 20 }, }; //directionalLight2.Transform.Position = Vector3.UnitX * 40; //directionalLight2.Transform.Rotation = Quaternion.RotationY(MathUtil.PiOverTwo); //Scene.Entities.Add(directionalLight2); SceneSystem.SceneInstance = new SceneInstance(Services, Scene); camera = new TestCamera(); CameraComponent = camera.Camera; Script.Add(camera); }
private void SetupScene() { graphicsCompositor = new SceneGraphicsCompositorLayers { Cameras = { Camera.Get<CameraComponent>() }, Master = { Renderers = { new ClearRenderFrameRenderer { Color = Color.Green, Name = "Clear frame" }, //new SceneCameraRenderer { Mode = new CameraRendererModeForward { Name = "Camera renderer", ModelEffect = "XenkoForwardShadingEffect" } }, new SceneCameraRenderer { Mode = new CameraRendererModeForward { Name = "Camera renderer" } }, } } }; Scene = new Scene { Settings = { GraphicsCompositor = graphicsCompositor } }; Scene.Entities.Add(Camera); //var ambientLight = new Entity { new LightComponent { Type = new LightAmbient { Color = new ColorRgbProvider(Color.White) }, Intensity = 1 } }; ////var ambientLight = new Entity { new LightComponent { Type = new LightDirectional { Color = new ColorRgbProvider(Color.White) }, Intensity = 1 } }; ////ambientLight.Transform.RotationEulerXYZ = new Vector3(0.0f, (float) Math.PI, 0.0f); //Scene.Entities.Add(ambientLight); var directionalLight = new Entity { new LightComponent { Type = new LightDirectional { Color = new ColorRgbProvider(Color.White), Shadow = { Enabled = true } }, Intensity = 1 }, }; directionalLight.Transform.Rotation = Quaternion.RotationY(MathUtil.PiOverTwo * 0.2f); Scene.Entities.Add(directionalLight); //var pointLight1 = new Entity { new LightComponent() { Type = new LightPoint { Color = new ColorRgbProvider(Color.Red), Radius = 100.0f, Shadow = { Enabled = false } }, Intensity = 1.0f } }; //pointLight1.Transform.Position.X = 5.0f; //Scene.Entities.Add(pointLight1); //var directionalLight2 = new Entity { new LightComponent { Type = new LightSpot { Range = 25, Color = new ColorRgbProvider(Color.White), Shadow = { Enabled = false } }, Intensity = 20 }, }; //directionalLight2.Transform.Position = Vector3.UnitX * 40; //directionalLight2.Transform.Rotation = Quaternion.RotationY(MathUtil.PiOverTwo); //Scene.Entities.Add(directionalLight2); var rand = new Random(); for (int i = 0; i < 512; ++i) { var pointLight1 = new Entity { new LightComponent() { Type = i % 2 == 0 ? (ILight)new LightPoint { Color = new ColorRgbProvider(new Color((float)rand.NextDouble(), (float)rand.NextDouble(), (float)rand.NextDouble(), 1.0f)), Radius = 2.0f, Shadow = { Enabled = false }, } : new LightSpot { Color = new ColorRgbProvider(new Color((float)rand.NextDouble(), (float)rand.NextDouble(), (float)rand.NextDouble(), 1.0f)), Range = 4.0f, Shadow = { Enabled = false }, }, Intensity = 10.0f } }; pointLight1.Transform.Position = new Vector3( (float)rand.NextDouble() * 20.0f - 10.0f, (float)rand.NextDouble() * 20.0f - 10.0f, (float)rand.NextDouble() * 20.0f - 10.0f ); Scene.Entities.Add(pointLight1); } SceneSystem.SceneInstance = new SceneInstance(Services, Scene); camera = new TestCamera(); CameraComponent = camera.Camera; Script.Add(camera); }
private void SetupScene() { // Load default graphics compositor SceneSystem.GraphicsCompositor = Content.Load <GraphicsCompositor>("GraphicsCompositor"); Scene = new Scene(); Scene.Entities.Add(Camera); //var ambientLight = new Entity { new LightComponent { Type = new LightAmbient { Color = new ColorRgbProvider(Color.White) }, Intensity = 1 } }; ////var ambientLight = new Entity { new LightComponent { Type = new LightDirectional { Color = new ColorRgbProvider(Color.White) }, Intensity = 1 } }; ////ambientLight.Transform.RotationEulerXYZ = new Vector3(0.0f, (float) Math.PI, 0.0f); //Scene.Entities.Add(ambientLight); var directionalLight = new Entity { new LightComponent { Type = new LightDirectional { Color = new ColorRgbProvider(Color.White), Shadow = { Enabled = true } }, Intensity = 1 }, }; directionalLight.Transform.Rotation = Quaternion.RotationY(MathUtil.PiOverTwo * 0.2f); Scene.Entities.Add(directionalLight); //var pointLight1 = new Entity { new LightComponent() { Type = new LightPoint { Color = new ColorRgbProvider(Color.Red), Radius = 100.0f, Shadow = { Enabled = false } }, Intensity = 1.0f } }; //pointLight1.Transform.Position.X = 5.0f; //Scene.Entities.Add(pointLight1); //var directionalLight2 = new Entity { new LightComponent { Type = new LightSpot { Range = 25, Color = new ColorRgbProvider(Color.White), Shadow = { Enabled = false } }, Intensity = 20 }, }; //directionalLight2.Transform.Position = Vector3.UnitX * 40; //directionalLight2.Transform.Rotation = Quaternion.RotationY(MathUtil.PiOverTwo); //Scene.Entities.Add(directionalLight2); var rand = new Random(); for (int i = 0; i < 512; ++i) { var pointLight1 = new Entity { new LightComponent() { Type = i % 2 == 0 ? (ILight) new LightPoint { Color = new ColorRgbProvider(new Color((float)rand.NextDouble(), (float)rand.NextDouble(), (float)rand.NextDouble(), 1.0f)), Radius = 2.0f, Shadow = { Enabled = false }, } : new LightSpot { Color = new ColorRgbProvider(new Color((float)rand.NextDouble(), (float)rand.NextDouble(), (float)rand.NextDouble(), 1.0f)), Range = 4.0f, Shadow = { Enabled = false }, }, Intensity = 10.0f } }; pointLight1.Transform.Position = new Vector3( (float)rand.NextDouble() * 20.0f - 10.0f, (float)rand.NextDouble() * 20.0f - 10.0f, (float)rand.NextDouble() * 20.0f - 10.0f ); Scene.Entities.Add(pointLight1); } SceneSystem.SceneInstance = new SceneInstance(Services, Scene); // Load default graphics compositor SceneSystem.GraphicsCompositor = Content.Load <GraphicsCompositor>("GraphicsCompositor"); camera = new TestCamera(Services.GetServiceAs <SceneSystem>().GraphicsCompositor); CameraComponent = camera.Camera; Script.Add(camera); }
private void SetupScene() { graphicsCompositor = new SceneGraphicsCompositorLayers { Cameras = { Camera.Get <CameraComponent>() }, Master = { Renderers = { new ClearRenderFrameRenderer { Color = Color.Green, Name = "Clear frame" }, //new SceneCameraRenderer { Mode = new CameraRendererModeForward { Name = "Camera renderer", ModelEffect = "XenkoForwardShadingEffect" } }, new SceneCameraRenderer { Mode = new CameraRendererModeForward{ Name = "Camera renderer" } }, } } }; Scene = new Scene { Settings = { GraphicsCompositor = graphicsCompositor } }; Scene.Entities.Add(Camera); //var ambientLight = new Entity { new LightComponent { Type = new LightAmbient { Color = new ColorRgbProvider(Color.White) }, Intensity = 1 } }; ////var ambientLight = new Entity { new LightComponent { Type = new LightDirectional { Color = new ColorRgbProvider(Color.White) }, Intensity = 1 } }; ////ambientLight.Transform.RotationEulerXYZ = new Vector3(0.0f, (float) Math.PI, 0.0f); //Scene.Entities.Add(ambientLight); var directionalLight = new Entity { new LightComponent { Type = new LightDirectional { Color = new ColorRgbProvider(Color.White), Shadow = { Enabled = true } }, Intensity = 1 }, }; directionalLight.Transform.Rotation = Quaternion.RotationY(MathUtil.PiOverTwo * 0.2f); Scene.Entities.Add(directionalLight); //var pointLight1 = new Entity { new LightComponent() { Type = new LightPoint { Color = new ColorRgbProvider(Color.Red), Radius = 100.0f, Shadow = { Enabled = false } }, Intensity = 1.0f } }; //pointLight1.Transform.Position.X = 5.0f; //Scene.Entities.Add(pointLight1); //var directionalLight2 = new Entity { new LightComponent { Type = new LightSpot { Range = 25, Color = new ColorRgbProvider(Color.White), Shadow = { Enabled = false } }, Intensity = 20 }, }; //directionalLight2.Transform.Position = Vector3.UnitX * 40; //directionalLight2.Transform.Rotation = Quaternion.RotationY(MathUtil.PiOverTwo); //Scene.Entities.Add(directionalLight2); var rand = new Random(); for (int i = 0; i < 512; ++i) { var pointLight1 = new Entity { new LightComponent() { Type = i % 2 == 0 ? (ILight) new LightPoint { Color = new ColorRgbProvider(new Color((float)rand.NextDouble(), (float)rand.NextDouble(), (float)rand.NextDouble(), 1.0f)), Radius = 2.0f, Shadow = { Enabled = false }, } : new LightSpot { Color = new ColorRgbProvider(new Color((float)rand.NextDouble(), (float)rand.NextDouble(), (float)rand.NextDouble(), 1.0f)), Range = 4.0f, Shadow = { Enabled = false }, }, Intensity = 10.0f } }; pointLight1.Transform.Position = new Vector3( (float)rand.NextDouble() * 20.0f - 10.0f, (float)rand.NextDouble() * 20.0f - 10.0f, (float)rand.NextDouble() * 20.0f - 10.0f ); Scene.Entities.Add(pointLight1); } SceneSystem.SceneInstance = new SceneInstance(Services, Scene); camera = new TestCamera(); CameraComponent = camera.Camera; Script.Add(camera); }