public bool InitializeGraphics() { try { Microsoft.DirectX.Direct3D.PresentParameters presentParams = new Microsoft.DirectX.Direct3D.PresentParameters(); presentParams.Windowed = true; presentParams.SwapEffect = Microsoft.DirectX.Direct3D.SwapEffect.Discard; //TODO device = new Microsoft.DirectX.Direct3D.Device(0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, this, Microsoft.DirectX.Direct3D.CreateFlags.SoftwareVertexProcessing, presentParams); Console.WriteLine("Device inizialisiert"); vb = new Microsoft.DirectX.Direct3D.VertexBuffer(typeof(Microsoft.DirectX.Direct3D.CustomVertex.TransformedColored), 6, this.device, 0, Microsoft.DirectX.Direct3D.CustomVertex.TransformedColored.Format, Microsoft.DirectX.Direct3D.Pool.Default); vb.Created += new System.EventHandler(this.OnCreateVertexBuffer); this.OnCreateVertexBuffer(vb, null); device.DeviceLost += new EventHandler(this.InvalidateDeviceObjects); device.DeviceReset += new EventHandler(this.restoreDeviceObjects); device.Disposing += new EventHandler(this.deleteDeviceObjects); device.DeviceResizing += new System.ComponentModel.CancelEventHandler(this.EnvironmentResizing); return(true); } catch (Microsoft.DirectX.DirectXException) { return(false); } }
public override void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { if (Enabled) { base.OnFrameRender(device, totalTime, elapsedTime); } }
public void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { switch (currentGameType) { case GameType.None: break; case GameType.Racing: if (race != null) { race.OnFrameRender(device, totalTime, elapsedTime); } break; case GameType.Bombing: if (bombing != null) { bombing.OnFrameRender(device, totalTime, elapsedTime); } break; case GameType.ScareCrow: if (scarecrow != null) { scarecrow.OnFrameRender(device, totalTime, elapsedTime); } break; } birds.OnFrameRender(device, totalTime, elapsedTime); }
public void OnFrameMove(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { float lookFromZ = Framework.Instance.CurrentCamera.LookFrom.Z; float lookFromX = Framework.Instance.CurrentCamera.LookFrom.X; foreach (GameObject corn in corns) { if (lookFromZ > corn.Position.Z) { corn.RotateYAngle = (float)Math.PI; } else { corn.RotateYAngle = 0; } } foreach (GameObject corn in perpCorns) { if (lookFromX > corn.Position.X) { corn.RotateYAngle = (float)-Math.PI / 2; } else { corn.RotateYAngle = (float)Math.PI / 2; } } }
public void OnFrameMove(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { UpdateGustSpeed(WindTime); CurrentDirection = Direction + DirectionVariance * Math.Sin(WindTime / 130.0); currentSpeed = ConstantWindSpeed; currentSpeed += currentGustSpeed; lock (this) { CurrentWind = new Vector3((float)(currentSpeed * Math.Cos(CurrentDirection)), 0, (float)(currentSpeed * Math.Sin(CurrentDirection))); } if (totalTime - lastSoundUpdate > 0.1) { UpdateSound(); lastSoundUpdate = totalTime; } foreach (ThermalSource source in thermalSources) { source.Visual.OnFrameMove(device, totalTime, elapsedTime); } if (showVectorField) { int i = 0; Vector3 playerPos = Program.Instance.Player.Position; foreach (LineMesh vector in vectors) { //int j = i / 3; //vector.Vertex1 = new Vector3(playerPos.X + 5 * ((j % 3) - 1), playerPos.Y + 5 * ((i % 3) - 1), playerPos.Z + 5 * ((j / 3) - 1)); vector.Vertex1 = new Vector3(playerPos.X + 5 * ((i % 3) - 1), playerPos.Y, playerPos.Z + 5 * ((i / 3) - 1)); vector.Vertex2 = vector.Vertex1 + 0.5f * GetWindAt(vector.Vertex1, false); vector.OnFrameMove(device, totalTime, elapsedTime); i++; } } }
public void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { foreach (Bird bird in birds) { bird.OnFrameRender(device, totalTime, elapsedTime); } }
public void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { if (towplane != null) { towplane.OnFrameRender(device, totalTime, elapsedTime); } }
public void Init() { PresentParameters present_params = new PresentParameters(); present_params.Windowed = true; present_params.SwapEffect = SwapEffect.Discard; _device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, present_params); font = new Microsoft.DirectX.Direct3D.Font(_device, 20, 0, FontWeight.Bold, 0, false, CharacterSet.Default, Precision.Default, FontQuality.Default, PitchAndFamily.DefaultPitch, "Arial"); _video = new Video("clock.avi"); _video.TextureReadyToRender += new TextureRenderEventHandler(_video_TextureReadyToRender); _video.RenderToTexture(_device); vertices = new CustomVertex.PositionTextured[6]; vertices[0].Position = new Vector3(1f, 1f, 0f); vertices[0].Tu = 0; vertices[0].Tv = 1; vertices[1].Position = new Vector3(-1f, -1f, 0f); vertices[1].Tu = 1; vertices[1].Tv = 1; vertices[2].Position = new Vector3(1f, -1f, 0f); vertices[2].Tu = 0; vertices[2].Tv = 0; vertices[3].Position = new Vector3(-1.1f, -0.99f, 0f); vertices[3].Tu = 1; vertices[3].Tv = 0; vertices[4].Position = new Vector3(0.99f, 1.1f, 0f); vertices[4].Tu = 0; vertices[4].Tv = 0; vertices[5].Position = new Vector3(-1.1f, 1.1f, 0f); vertices[5].Tu = 1; vertices[5].Tv = 1; }
/// <summary> /// Performs the render step for the textures. /// </summary> /// <param name="device"></param> /// <param name="totalTime"></param> /// <param name="elapsedTime"></param> public void RenderTextures(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { if (water != null) { water.RenderTextures(device, totalTime, elapsedTime); } }
public AGT_SceneLoadDialog(Microsoft.DirectX.Direct3D.Device device, IAGT_SceneLoadDialog resource_loader) { _video_device = device; _resource_loader = resource_loader; InitializeComponent(); _resource_loader.DialogInitialize(this); }
public void RenderTextures(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { foreach (Water water in waters) { water.RenderTextures(device, totalTime, elapsedTime); } }
public void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { float distance = 100.0f; if (Program.Instance.Player != null) { distance = Program.Instance.Player.Position.Length(); if (distance > 128) { distance = Math.Max(0.5f - (distance - 128) / 1024, 0.001f); } else { distance = 1f - distance / 255f; } } for (int i = 0; i < 6; i++) { if (objects[i] != null) { objects[i].Shader.SetVariable("Background", 1); objects[i].Shader.SetVariable("Distance", distance); objects[i].OnFrameRender(device, totalTime, elapsedTime); } } }
public override void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { if (currentObject != null) { base.OnFrameRender(device, totalTime, elapsedTime); } }
public override void OnFrameMove(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { UpdatePosition(totalTime, elapsedTime); frontWheels.RotateXAngle = (float)(1.2f * speed * totalTime); rearWheels.RotateXAngle = (float)(speed * totalTime / 1.6f); base.OnFrameMove(device, totalTime, elapsedTime); }
public void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { foreach (RecordedFlight flight in recordedFlights) { flight.OnFrameRender(device, totalTime, elapsedTime); } }
public override void OnFrameMove(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { particleSystem.Position = this.Position; particleSystem.Intensity = Math.Max(5, Convert.ToInt32(airplaneControl.Throttle * 100.0)); particleSystem.WindVector = owner.Weather.Wind.CurrentWind; particleSystem.OnFrameMove(device, totalTime, elapsedTime); base.OnFrameMove(device, totalTime, elapsedTime); }
public override void OnFrameMove(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { foreach (WaterRipple ripple in ripples) { ripple.OnFrameMove(device, totalTime, elapsedTime); } base.OnFrameMove(device, totalTime, elapsedTime); }
public void OnFrameMove(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { for (int i = 0; i < recordedFlights.Count; i++) { RecordedFlight flight = recordedFlights[i]; flight.OnFrameMove(device, totalTime, elapsedTime); } }
public override void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { if (water != null) { water.OnFrameRender(device, totalTime, elapsedTime); } base.OnFrameRender(device, totalTime, elapsedTime); }
public void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { foreach (Gate gate in gates) { gate.OnFrameRender(device, totalTime, elapsedTime); } arrow.OnFrameRender(device, totalTime, elapsedTime); }
public void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { foreach (Tree tree in trees) { tree.OnFrameRender(device, totalTime, elapsedTime); } // Do nothing (transparentobjectmanager will do all) }
public override void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { if (particleSystem.Visible) { particleSystem.OnFrameRender(device, totalTime, elapsedTime); } base.OnFrameRender(device, totalTime, elapsedTime); }
public void updateViewMatrix(Microsoft.DirectX.Direct3D.Device d3dDevice) { if (!enable) { return; } d3dDevice.Transform.View = viewMatrix; }
/// <summary> /// Actualiza la ViewTGCMatrix, si es que la camara esta activada /// </summary> public void updateViewTGCMatrix(Device d3dDevice) { if (!Enable) { return; } d3dDevice.Transform.View = viewTGCMatrix; }
void IFrameworkCallback.OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { // Move device.Transform.World = transformMatrix; // Render mesh.OnFrameRender(device, totalTime, elapsedTime); // Reset transformation device.Transform.World = Matrix.Identity; }
public override void OnFrameMove(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { if (currentObject != null) { this.Position = (Vector3)(currentObject["Position"]) + new Vector3(0, 4f, 0); this.Orientation = new Vector3(0, (float)totalTime, 0); base.OnFrameMove(device, totalTime, elapsedTime); } }
public override void OnFrameMove(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { if (particleSystem.Visible) { particleSystem.Position = this.Position; particleSystem.WindVector = new Microsoft.DirectX.Vector3(0, this.strength, 0); particleSystem.OnFrameMove(device, totalTime, elapsedTime); } base.OnFrameMove(device, totalTime, elapsedTime); }
public void OnFrameRender(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { if (visible) { foreach (Flare flare in flares) { flare.Object.OnFrameRender(device, totalTime, elapsedTime); } } }
public void OnFrameMove(Microsoft.DirectX.Direct3D.Device device, double totalTime, float elapsedTime) { for (int i = 0; i < 6; i++) { if (objects[i] != null) { objects[i].OnFrameMove(device, totalTime, elapsedTime); } } }
/// <summary> /// Se llama una sola vez, al principio cuando se ejecuta el ejemplo. /// Escribir aquí todo el código de inicialización: cargar modelos, texturas, estructuras de optimización, todo /// procesamiento que podemos pre calcular para nuestro juego. /// Borrar el codigo ejemplo no utilizado. /// </summary> public override void Init() { //Device de DirectX para crear primitivas. d3dDevice = D3DDevice.Instance.Device; //Instancio el loader del framework loader = new TgcSceneLoader(); //creo usuario Player1 = new Player(); Player1.gameModel = this; //inicializo mesh para hacha Axe = loader.loadSceneFromFile(MediaDir + "Meshes\\Hacha\\Hacha-TgcScene.xml").Meshes[0]; //Inicializo cámara MyCamera = new TgcFpsCamera(Player1, Axe, Input, (MapLength / 2), -(MapLength / 2), (MapLength / 2), -(MapLength / 2)); Camara = MyCamera; Frustum.updateVolume(D3DDevice.Instance.Device.Transform.View, D3DDevice.Instance.Device.Transform.Projection); //genero el mundo MyWorld = new World(MediaDir, d3dDevice, loader, Camara, Frustum, MapLength, true); MyWorld.RenderDistance = RenderDistance; //inicializo efectos effectsManager = new EffectsManager(ShadersDir, this, MyWorld, ElapsedTime); effectsManager.applyEffect(Axe); //emisor de partículas emitter = new ParticleEmitter(MediaDir + "Textures\\smokeParticle.png", 10); emitter.Position = new Vector3(0, 0, 0); emitter.MinSizeParticle = 2f; emitter.MaxSizeParticle = 5f; emitter.ParticleTimeToLive = 1f; emitter.CreationFrecuency = 1f; emitter.Dispersion = 25; emitter.Speed = new Vector3(5f, 5f, 5f); //colisiones pickingRay = new TgcPickingRay(Input); //sonidos soundPlayer = new SoundPlayer(DirectSound, MediaDir); soundPlayer.startAmbient(); //gui MenuInterface = new GUI(MediaDir, D3DDevice.Instance, Player1, this); TopRightText = GameUtils.createText("", 0, 0, 20, true); TopRightText.Color = Color.LightGray; TopRightText.Align = TgcText2D.TextAlign.RIGHT; CenterText = GameUtils.createText("", 0, (D3DDevice.Instance.Height * 0.85f), 25, true); CenterText.Color = Color.DodgerBlue; CenterText.Align = TgcText2D.TextAlign.CENTER; }
public xMouse(Control Owner, Microsoft.DirectX.Direct3D.Device device, bool bWindowed) { m_Owner = Owner; d3ddevice = device; mouse = new Device(SystemGuid.Mouse); mouse.SetDataFormat(DeviceDataFormat.Mouse); mouse.SetCooperativeLevel(m_Owner, CooperativeLevelFlags.Background | CooperativeLevelFlags.NonExclusive); mouse.Properties.AxisModeAbsolute = false; buttons = new bool[256]; m_bWindowed = bWindowed; m_XPos = 0f; m_YPos = 0f; m_ObjectSpace = new Vector3(0f, 0f, 0f); m_ObjectSpace2 = new Vector3(0f, 0f, 0f); m_Clicked = false; }
private void StartupGUI(object target) { // Enforce the underlying Irrlicht engine to load a local D3DX9_40.dll // (Note: Environment.CurrentDirectory is visible to other plug-ins) Environment.CurrentDirectory = Util.ApplicationDataDirectory; SetupAddins(); SetupLog(); f = new RenderForm(this); f.Width = width; f.Height = height; f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; f.ImeMode = System.Windows.Forms.ImeMode.Inherit; try { SetParent(f.Handle, (IntPtr)target); #if MANAGED_D3D Microsoft.DirectX.Direct3D.PresentParameters pp = new Microsoft.DirectX.Direct3D.PresentParameters(); pp.Windowed = true; pp.SwapEffect = Microsoft.DirectX.Direct3D.SwapEffect.Discard; try { d3ddevice = new Microsoft.DirectX.Direct3D.Device( 0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, f, Microsoft.DirectX.Direct3D.CreateFlags.SoftwareVertexProcessing, pp ); } catch { try { d3ddevice = new Microsoft.DirectX.Direct3D.Device( 0, Microsoft.DirectX.Direct3D.DeviceType.Reference, f, Microsoft.DirectX.Direct3D.CreateFlags.SoftwareVertexProcessing, pp ); } catch { } } CreateVideoObject(); #endif } catch (System.Exception) { } f.Location = new System.Drawing.Point(0, 0); //f.FormClosed += new System.Windows.Forms.FormClosedEventHandler(f_FormClosed); f.Show(); renderTarget = f.Handle; try { string iniconfig = System.IO.Path.Combine(Util.ConfigFolder, "OpenViewer.ini"); m_config.Load(iniconfig); // Check and clean cache if request last time. string cacheFlag = m_config.Source.Configs["Startup"].Get("cache_delete", "false"); if (cacheFlag == "true") { CleanChache(); } } catch (Exception e) { m_log.Fatal("can't load config file.", e); } try { device = new IrrlichtDevice(DriverType.Direct3D9, new Dimension2D(width, height), 32, false, true, false, false, renderTarget); if (device == null) { m_log.Error("can't create irrlicht device."); System.Windows.Forms.MessageBox.Show(DialogText.ErrorGraphicDriverMessage, DialogText.ErrorGraphicDriverCaption); } } catch (Exception e) { m_log.Error("can't create irrlicht device.", e); System.Windows.Forms.MessageBox.Show(DialogText.ErrorGraphicDriverMessage, DialogText.ErrorGraphicDriverCaption); device = null; } if (device == null) { // release all. // exit application. return; } else { m_log.InfoFormat("AdapterVendorID: 0x{0:x8}", device.VideoDriver.AdapterVendorId); m_log.InfoFormat("AdapterDeviceId: 0x{0:x8}", device.VideoDriver.AdapterDeviceId); m_log.InfoFormat("AdapterSubSysId: 0x{0:x8}", device.VideoDriver.AdapterSubSysId); m_log.InfoFormat("AdapterRevision: 0x{0:x8}", device.VideoDriver.AdapterRevision); m_log.InfoFormat("AdapterMaxTextureHeight: {0}", device.VideoDriver.AdapterMaxTextureHeight); m_log.InfoFormat("AdapterMaxTextureWidth: {0}", device.VideoDriver.AdapterMaxTextureWidth); m_log.InfoFormat("AdapterMaxActiveLights: {0}", device.VideoDriver.AdapterMaxActiveLights); m_log.InfoFormat("AdapterVertexShaderVersion: 0x{0:x8}", device.VideoDriver.AdapterVertexShaderVersion); m_log.InfoFormat("AdapterPixelShaderVersion: 0x{0:x8}", device.VideoDriver.AdapterPixelShaderVersion); // AdapterVendorId // 0x1002 : ATI Technologies Inc. // 0x10DE : NVIDIA Corporation // 0x102B : Matrox Electronic Systems Ltd. // 0x121A : 3dfx Interactive Inc // 0x5333 : S3 Graphics Co., Ltd. // 0x8086 : Intel Corporation // if (device.VideoDriver.AdapterVendorId == 0x1002) { string warningMessage = DialogText.WarningGraphicCardMessage; string warningCaption = DialogText.WarningGraphicCardCaption; System.Windows.Forms.DialogResult yesno = System.Windows.Forms.MessageBox.Show(warningMessage, warningCaption, System.Windows.Forms.MessageBoxButtons.YesNo); if (System.Windows.Forms.DialogResult.Yes != yesno) { return; } } } reference = new RefController(this); device.OnEvent += new OnEventDelegate(device_OnEvent); // If enabled is true, videotexture is not correctly render. device.VideoDriver.SetTextureFlag(TextureCreationFlag.CreateMipMaps, false); #if DEBUG device.Logger.LogLevel = LogLevel.Information; #endif // Create video Textrue videoTexture = device.VideoDriver.GetTexture(Util.ApplicationDataDirectory + @"\media\textures\videoTexture.tga"); IrrlichtNETCP.Extensions.TTFont font = new TTFont(Device.VideoDriver); IrrlichtNETCP.Extensions.TTFace face = new TTFace(); bool font_loaded = false; uint fontsize = 16; string fontface = Config.Source.Configs["Startup"].GetString("guifont_face"); if (!string.IsNullOrEmpty(Config.Source.Configs["Startup"].GetString("guifont_size"))) { fontsize = (uint)Config.Source.Configs["Startup"].GetInt("guifont_size"); } if (!string.IsNullOrEmpty(fontface)) { if (System.IO.File.Exists(System.Environment.SystemDirectory + @"\..\Fonts\" + fontface)) { face.Load(System.Environment.SystemDirectory + @"\..\Fonts\" + fontface); font.Attach(face, fontsize); font.Antialias = true; Reference.GUIEnvironment.Skin.Font = font; font_loaded = true; } else { m_log.Warn("[FONT]: The specified font (" + fontface + ") was not available on this system. Reverting to default."); } } if (!font_loaded) { if (System.IO.File.Exists(System.Environment.SystemDirectory + @"\..\Fonts\msgothic.ttc")) { face.Load(System.Environment.SystemDirectory + @"\..\Fonts\msgothic.ttc"); font.Attach(face, fontsize); font.Antialias = true; Reference.GUIEnvironment.Skin.Font = font; } else { JapaneseEnabled = false; Locale = "en"; System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); if (System.IO.File.Exists(System.Environment.SystemDirectory + @"\..\Fonts\arial.ttf")) { face.Load(System.Environment.SystemDirectory + @"\..\Fonts\arial.ttf"); font.Attach(face, fontsize); font.Antialias = true; Reference.GUIEnvironment.Skin.Font = font; } else { // Use built in font--- this looks horrible and should be avoided if possible Reference.GUIEnvironment.Skin.Font = Reference.GUIEnvironment.BuiltInFont; } } } font.Drop(); face.Drop(); // if font and face are being used, at this point face and font should both have reference counts of 1. // if font and face are not being used (last else branch above, using built-in font), font and face should both be deleted at this point. // Zaki: Adding Japanese support end Reference.VideoDriver.SetFog(new Color(0, 255, 255, 255), false, 9999, 9999, 0, false, false); //Reference.Device.FileSystem.WorkingDirectory = Util.UserCacheDirectory; Reference.Device.FileSystem.AddFolderFileArchive(Util.ApplicationDataDirectory); Reference.Device.FileSystem.AddFolderFileArchive(Util.ModelFolder); Reference.Device.FileSystem.AddFolderFileArchive(Util.TextureFolder); camera = new Camera(this); // Create managers. cacheManager = new CacheManager(this, -1); try { string iniconfig = System.IO.Path.Combine(Util.ConfigFolder, "OpenViewer.ini"); m_config.Load(iniconfig); // Check and clean cache if request last time. string s_cacheMB = m_config.Source.Configs["Startup"].Get("cache_size", DEFAULT_CACHE_MB_SIZE.ToString()); long cacheMB = DEFAULT_CACHE_MB_SIZE; if (long.TryParse(s_cacheMB, out cacheMB)) { cacheMB = cacheMB * 1000 * 1000; cacheManager.CacheMaxSize = cacheMB; cacheManager.Clean(); } } catch (Exception e) { m_log.Fatal("can't load config file.", e); } // Locale can be used from this point on if (Locale == "en") { DialogText.Culture = new System.Globalization.CultureInfo("en-US"); System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); } if (Locale == "jp") { DialogText.Culture = new System.Globalization.CultureInfo("ja-JP"); System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ja-JP"); } stateManager = new Managers.StateManager(this); protocolManager = new Managers.ProtocolManager(this); guiManager = new GuiManager(this); menuManager = new MenuManager(this); shaderManager = new ShaderManager(this); entityManager = new EntityManager(this); irrManager = new IrrManager(this, -1); textureManager = new TextureManager(this); textureManager.OnTextureLoaded += OnTextureComplete; terrainManager = new Managers.TerrainManager(this); avatarManager = new Managers.AvatarManager(this); effectManager = new Managers.EffectManager(this); chatManager = new Managers.ChatManager(this); soundManager = new Managers.SoundManager(this); debugManager = new DebugManager(this, -1); // Experimental manager plugin loader LoadPlugins(); // Initialize. Initialize(); // Event stateManager.OnChanged += StateChanged; clearColor = Color.FromBCL(Util.FromString(BackgroundColor)); progressBarColor = Color.FromBCL(Util.FromString(ProgressColor, System.Drawing.Color.FromArgb(63, 0, 0, 0))); guiManager.LoadBackgrounds(); soundManager.InitWindowBackgroundMusicURL = InitBackgroundMusicURL; soundManager.LoadBackgroundMusic(); // After all managers all initialized stateManager.State = State.INITIALIZED; adapter.Initialize(this.reference); adapter.CallSetWorldAmbientColor(WorldAmbientColor); adapter.CallSetFixDirectional(FixDirectional); adapter.CallSetFixDirectionalRotation(FixDirectionalRotation); adapter.CallSetFixDirectionalDiffuseColor(FixDirectionalDiffuseColor); adapter.CallSetFixDirectionalAmbientColor(FixDirectionalAmbientColor); SetLogFilter(); guiManager.ShowLoginWindow(new LoginInfo(ServerURI, FirstName, LastName, Password, LoginMode, true, true)); // Hide mouse cursor. ShowCursor(false); #if _SECOND_SURFACE_ON pip = Reference.VideoDriver.CreateRenderTargetTexture(new Dimension2D(256, 256)); pipImage = Reference.GUIEnvironment.AddImage(pip, new Position2D(Width - pip.OriginalSize.Width - 10, 40), false, Reference.GUIEnvironment.RootElement, -1, ""); CameraSceneNode oldCam = Reference.SceneManager.ActiveCamera; pipCamera = Reference.SceneManager.AddCameraSceneNode(Reference.SceneManager.RootSceneNode); material.Lighting = false; if (Reference.SceneManager.ActiveCamera.Raw != oldCam.Raw) Reference.SceneManager.ActiveCamera = oldCam; #endif System.Windows.Forms.DialogResult dialogRes = System.Windows.Forms.DialogResult.Retry; while (dialogRes == System.Windows.Forms.DialogResult.Retry) { dialogRes = RenderLoop(); } #if MANAGED_D3D try { if (video != null) { lock (video) { video.Stop(); video.Dispose(); } } if (d3ddevice != null) { lock (d3ddevice) { d3ddevice.Dispose(); d3ddevice = null; } } } catch { } #endif if (device != null) { device.Dispose(); device = null; } }
public AGT_SceneLoadDialog(AGT_CanvasControl AGT_Canvas, IAGT_SceneLoadDialog resource_loader) { _video_device = AGT_Canvas.VideoDevice; _resource_loader = resource_loader; InitializeComponent(); }