/// <summary> /// Settaggio manuale di un Device fullscreen /// </summary> /// <param name="handle"></param> /// <param name="BackBufferHeight"></param> /// <param name="BackBufferWidth"></param> /// <param name="RefreshRateInHz"></param> /// <param name="BackBufferFormat"></param> /// <param name="BackBufferCount"></param> /// <param name="SwapEffect"></param> /// <param name="DeviceType"></param> /// <param name="CreateFlags"></param> /// <param name="MultiSample"></param> /// <returns></returns> public bool SetManualEngine(Control handle, int BackBufferHeight, int BackBufferWidth, int RefreshRateInHz, Format BackBufferFormat, int BackBufferCount, SwapEffect SwapEffect, Microsoft.DirectX.Direct3D.DeviceType DeviceType, CreateFlags CreateFlags, MultiSampleType MultiSample) { try { my_params_x.Windowed = false; my_params_x.BackBufferHeight = BackBufferHeight; my_params_x.BackBufferWidth = BackBufferWidth; my_params_x.BackBufferFormat = BackBufferFormat; my_params_x.FullScreenRefreshRateInHz = RefreshRateInHz; my_params_x.MultiSample = MultiSample; my_params_x.EnableAutoDepthStencil = true; my_params_x.AutoDepthStencilFormat = DepthFormat.D16; my_params_x.BackBufferCount = 1; my_params_x.SwapEffect = SwapEffect; device = new Microsoft.DirectX.Direct3D.Device(0, DeviceType, handle, CreateFlags, my_params_x); errorsToPrint = new PrintScreen("arial", 12); return true; } catch (DirectXException) { errorsToPrint = new PrintScreen("arial", 12); return false; } }
private void SetObjects() { //lxe.SetAutoEngine(this, true); //lxe.SetManualEngine(this, LogiX_Engine.CurrentDisplayHeight, LogiX_Engine.CurrentDisplayWitdh, LogiX_Engine.CurrentDisplayRefreshRate, Format.X8R8G8B8, 0, SwapEffect.Discard, DeviceType.Hardware, CreateFlags.SoftwareVertexProcessing, MultiSampleType.FourSamples); lxe.SetManualEngine(this, 0, SwapEffect.Discard, DeviceType.Hardware, CreateFlags.SoftwareVertexProcessing, MultiSampleType.FourSamples); cam = new Camera(new VertexData(0,0,-1000), VertexData.Empty, new VertexData(0,1,0),(float)Math.PI/4, 2.0f, 10000000000, 1); //cam.AspectRatio = (float)LogiX_Engine.CurrentDisplayWitdh / (float)LogiX_Engine.CurrentDisplayHeight; cam.AspectRatio = (float)this.ClientSize.Width / (float)this.ClientSize.Height; mouse = new Mouse(this); mouse.DistanceForCameraTrackBall = 7000; cam.FieldOfView = 2 * (float)Math.PI / 6; keyboard = new Keyboard(this); Sole = new Sole(); sunlight = new PointLight(new VertexData(0, 0, 0), Color.FromArgb(50, 50, 50), Color.FromArgb(15,15,15), Color.OrangeRed, 10000000000000000000); sunlight.Attenuation0 = 1; lxe.SetRenderState(XTeam.LogiX_Technologies.RenderStates.Solid); Terra = new Pianeta(149.6f, 6370, 0.48f, 1, 365, new XTexture("MEDIA\\texterrahd.jpg"), "Terra"); Venere = new Pianeta(108, 6052, 0, -117, 224.70059f, new XTexture("MEDIA\\venusmap.jpg"), "Venere"); Mercurio = new Pianeta(57.909f, 2440, 0, 58.6462f, 87.969f, new XTexture("MEDIA\\mercury.jpg"), "Mercurio"); Marte = new Pianeta(228, 3392.8f, 0, 1.025957f, 686.979f, new XTexture("MEDIA\\mars.jpg"), "Marte"); Giove = new Pianeta(778.412f, 71492, 0, 0.413538021f, 4333.2867f, new XTexture("MEDIA\\jupiter.jpg"), "Giove"); Saturno = new Pianeta(1426.725413f, 60268, 0.47f, 0.449375f, 10756.1995f, new XTexture("MEDIA\\saturn.jpg"), "Saturno"); Urano = new Pianeta(2870.972220f, 25559, 1.71f, -0.71875f, 30685.55f, new XTexture("MEDIA\\uranus.jpg"), "Urano"); Nettuno = new Pianeta(4498.252900f, 24764, 0.49f, 0.67125f, 60223.3528f,new XTexture("MEDIA\\neptune.jpg"), "Nettuno"); Luna = new Satellite(Terra, 384.400f, 1738, 0, 28, 28, new XTexture("MEDIA\\texlunahd.jpg"), "Luna"); Phobos = new Satellite(Marte, 9.377f, 200, 0, 1, 0.2916666f, new XTexture("MEDIA\\texphobos.jpg"), "Phobos", new Model("MEDIA\\phobos.x", 0)); Deimos = new Satellite(Marte, 23.460f, 200, 0, 0.31891023f, 0.31891023f, new XTexture("MEDIA\\deimos.jpg"), "Deimos", new Model("MEDIA\\deimos.x", 0)); Io = new Satellite(Giove, 421.700f, 1821.3f, 0, 1.769137786f, 1.769137786f, new XTexture("MEDIA\\io.jpg"), "Io"); Europa = new Satellite(Giove, 671.034f, 1560.8f, 0, 3.551181041f, 3.551181041f, new XTexture("MEDIA\\europa.jpg"), "Europa"); Ganimede = new Satellite(Giove, 1070.400f, 2631.2f, 0, 7.15455296f, 7.15455296f, new XTexture("MEDIA\\ganimede.jpg"), "Ganimede"); Callisto = new Satellite(Giove, 1882.700f, 2410.3f, 0, 16.6890184f, 16.6890184f, new XTexture("MEDIA\\callisto.jpg"), "Ganimede"); Sky = new CieloStellato(); info = new PrintScreen("arial", 16); PianetaSelezionato = Terra; mod = new Model("MEDIA\\Sfera4.x", 0); RingColor = new XTexture("MEDIA\\saturnringcolor.jpg"); RingPattern = new XTexture("MEDIA\\saturnringpattern.jpg"); Saturno.CreaAnelli(RingColor, RingPattern); Urano.CreaAnelli(new XTexture("MEDIA\\uranusringcolour1.jpg"), new XTexture("MEDIA\\uranusringtrans.png")); if (!hdEnable) { hd1 = hd2 = hd3 = hd4 = hd5 = hd6 = hd7 = hd8 = hd9 = hd10 = hd11 = hd12 = hd13 = hd14 = hd15 = true; } }
/// <summary> /// Settaggio automatico di un Device /// </summary> /// <param name="Handle"></param> /// <param name="Windowed"></param> /// <returns></returns> public bool SetAutoEngine(Control Handle, bool Windowed) { try { if (!Windowed) { my_params_x.Windowed = false; my_params_x.BackBufferHeight = CurrentDisplayHeight; my_params_x.BackBufferWidth = CurrentDisplayWitdh; my_params_x.BackBufferFormat = CurrentDisplayFormat; my_params_x.FullScreenRefreshRateInHz = CurrentDisplayRefreshRate; my_params_x.MultiSample = MultiSampleType.TwoSamples; my_params_x.EnableAutoDepthStencil = true; my_params_x.AutoDepthStencilFormat = DepthFormat.D16; my_params_x.BackBufferCount = 1; my_params_x.SwapEffect = SwapEffect.Discard; device = new Microsoft.DirectX.Direct3D.Device(0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, Handle, CreateFlags.SoftwareVertexProcessing, my_params_x); } else { my_params_x.Windowed = true; my_params_x.BackBufferFormat = CurrentDisplayFormat; my_params_x.MultiSample = MultiSampleType.TwoSamples; my_params_x.EnableAutoDepthStencil = true; my_params_x.AutoDepthStencilFormat = DepthFormat.D16; my_params_x.BackBufferCount = 1; my_params_x.SwapEffect = SwapEffect.Discard; device = new Microsoft.DirectX.Direct3D.Device(0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, Handle, CreateFlags.SoftwareVertexProcessing, my_params_x); } errorsToPrint = new PrintScreen("arial", 12); return true; } catch (DirectXException) { errorsToPrint = new PrintScreen("arial", 12); return false; } }