public Resize ( int newWidth, int newHeight ) : void | ||
newWidth | int | |
newHeight | int | |
리턴 | void |
/// <summary> /// Intializes graphics engine. /// </summary> public override void Initialize() { // init components : InitializeComponent(spriteEngine); InitializeComponent(filter); InitializeComponent(ssaoFilter); InitializeComponent(hdrFilter); InitializeComponent(dofFilter); InitializeComponent(lightRenderer); InitializeComponent(sceneRenderer); InitializeComponent(sky); InitializeComponent(bitonicSort); InitializeComponent(vtSystem); // create default textures : whiteTexture = new DynamicTexture(this, 4, 4, typeof(Color), false, false); whiteTexture.SetData(Enumerable.Range(0, 16).Select(i => Color.White).ToArray()); grayTexture = new DynamicTexture(this, 4, 4, typeof(Color), false, false); grayTexture.SetData(Enumerable.Range(0, 16).Select(i => Color.Gray).ToArray()); blackTexture = new DynamicTexture(this, 4, 4, typeof(Color), false, false); blackTexture.SetData(Enumerable.Range(0, 16).Select(i => Color.Black).ToArray()); flatNormalMap = new DynamicTexture(this, 4, 4, typeof(Color), false, false); flatNormalMap.SetData(Enumerable.Range(0, 16).Select(i => new Color(127, 127, 255, 127)).ToArray()); // set sprite layers : SpriteLayers = new SpriteLayerCollection(); // add default render world : renderWorld = new RenderWorld(Game, Width, Height); DisplayBoundsChanged += (s, e) => renderWorld.Resize(DisplayBounds.Width, DisplayBounds.Height); }
/// <summary> /// /// </summary> public override void Initialize () { debugFont = Game.Content.Load<DiscTexture>("conchars"); //videoPlayer = new VideoPlayer(); //video = new Video(@"C:\infection_demo.wmv");//*/ ////video = GameEngine.Content.Load<Video>("infection_demo"); //video = new Video(File.ReadAllBytes(@"C:\infection_demo.wmv"));//*/ //var mtrl = GameEngine.Content.Load<Material>("testMtrl"); var bounds = Game.RenderSystem.DisplayBounds; masterView = Game.RenderSystem.RenderWorld; Game.RenderSystem.DisplayBoundsChanged += (s,e) => { masterView.Resize( Game.RenderSystem.DisplayBounds.Width, Game.RenderSystem.DisplayBounds.Height ); //Log.Warning("{0} {1}", GameEngine.GraphicsEngine.DisplayBounds.Width, GameEngine.GraphicsEngine.DisplayBounds.Height); }; targetTexture = new TargetTexture(Game.RenderSystem, bounds.Width, bounds.Height, TargetFormat.LowDynamicRange ); //masterView.Target = targetTexture; testLayer = new SpriteLayer( Game.RenderSystem, 1024 ); uiLayer = new SpriteLayer( Game.RenderSystem, 1024 ); texture = Game.Content.Load<DiscTexture>( "lena" ); masterView.SkySettings.SunPosition = new Vector3(20,30,40); masterView.SkySettings.SunLightIntensity = 50; masterView.SkySettings.SkyTurbidity = 3; masterView.LightSet.SpotAtlas = Game.Content.Load<TextureAtlas>("spots/spots"); masterView.LightSet.DirectLight.Direction = masterView.SkySettings.SunLightDirection; masterView.LightSet.DirectLight.Intensity = masterView.SkySettings.SunLightColor; masterView.LightSet.DirectLight.Enabled = true; masterView.LightSet.AmbientLevel = Color4.Zero; //masterView.LightSet.AmbientLevel = masterView.SkySettings.AmbientLevel; masterView.LightSet.EnvLights.Add( new EnvLight( new Vector3(0,4,-10), 1, 500 ) ); //masterView.LightSet.EnvLights.Add( new EnvLight( new Vector3(0,4,-10), 1, 15 ) ); //masterView.LightSet.EnvLights.Add( new EnvLight( new Vector3(0,4, 10), 1, 15 ) ); var rand = new Random(); /*for (int i=0; i<64; i++) { var light = new OmniLight(); light.Position = new Vector3( 8*(i/8-4), 4, 8*(i%8-4) ); light.RadiusInner = 1; light.RadiusOuter = 8; light.Intensity = rand.NextColor4() * 100; masterView.LightSet.OmniLights.Add( light ); } //*/ /*for (int i=0; i<256; i++) { var light = new EnvLight(); light.Position = new Vector3( 7*(i/16-8), 6, 7*(i%16-8) ); light.RadiusInner = 2; light.RadiusOuter = 8; masterView.LightSet.EnvLights.Add( light ); } //*/ fireLight = new OmniLight(); fireLight.Position = Vector3.UnitZ * (-10) + Vector3.UnitY * 5 + Vector3.UnitX * 20; fireLight.RadiusOuter = 7; fireLight.Intensity = new Color4(249, 172, 61, 0)/2; masterView.LightSet.OmniLights.Add( fireLight ); masterView.SpriteLayers.Add( console.ConsoleSpriteLayer ); masterView.SpriteLayers.Add( uiLayer ); masterView.SpriteLayers.Add( testLayer ); Game.Keyboard.KeyDown += Keyboard_KeyDown; LoadContent(); Game.Reloading += (s,e) => LoadContent(); Game.Touch.Tap += vector2 => System.Console.WriteLine("You just perform tap gesture at point: " + vector2); Game.Touch.DoubleTap += vector2 => System.Console.WriteLine("You just perform double tap gesture at point: " + vector2); Game.Touch.SecondaryTap += vector2 => System.Console.WriteLine("You just perform secondary tap gesture at point: " + vector2); Game.Touch.Manipulate += (center, delta, scale) => System.Console.WriteLine("You just perform touch manipulation: " + center + " " + delta + " " + scale); }