public TextureManager(IrrDevice irrDevice) { this.irrDevice = irrDevice; threadCommands = new Queue <ThreadCommand>(); loadedTextures = new List <string>(); // generate "no preview" texture int h = 256; Image i = irrDevice.DriverNoCheck.CreateImage(ColorFormat.A8R8G8B8, new Dimension2Di(h)); i.Fill(new Color(0x112233)); for (int a = 0; a < h; a++) { i.SetPixel(a, 0, new Color(0x557799)); i.SetPixel(a, h - 1, new Color(0x557799)); i.SetPixel(0, a, new Color(0x557799)); i.SetPixel(h - 1, a, new Color(0x557799)); if (a > 16 && a < h - 16) { i.SetPixel(a, a, new Color(0x557799)); i.SetPixel(h - a - 1, a, new Color(0x557799)); } } irrDevice.Lock(); noPreviewTexture = irrDevice.Driver.AddTexture("NoPreviewTexture", i); irrDevice.Unlock(); i.Drop(); }
public TextureManager(IrrDevice irrDevice) { this.irrDevice = irrDevice; threadCommands = new Queue<ThreadCommand>(); loadedTextures = new List<string>(); // generate "no preview" texture int h = 256; Image i = irrDevice.DriverNoCheck.CreateImage(ColorFormat.A8R8G8B8, new Dimension2Di(h)); i.Fill(new Color(0x112233)); for (int a = 0; a < h; a++) { i.SetPixel(a, 0, new Color(0x557799)); i.SetPixel(a, h - 1, new Color(0x557799)); i.SetPixel(0, a, new Color(0x557799)); i.SetPixel(h - 1, a, new Color(0x557799)); if (a > 16 && a < h - 16) { i.SetPixel(a, a, new Color(0x557799)); i.SetPixel(h - a - 1, a, new Color(0x557799)); } } irrDevice.Lock(); noPreviewTexture = irrDevice.Driver.AddTexture("NoPreviewTexture", i); irrDevice.Unlock(); i.Drop(); }
public AnimationManager(IrrDevice irrDevice) { this.irrDevice = irrDevice; }
static void Main() { irr = new IrrDevice(); irr.CreateDevice(DriverType.Direct3D9, new Dimension2Di(1024, 600)); animationManager = new AnimationManager(irr); textureManager = new TextureManager(irr); textureManager.OnTextureLoaded += new TextureManager.TextureLoadedDelegate(textureManager_OnTextureLoaded); irr.Lock(); irr.Device.SetWindowResizable(true); irr.Device.OnEvent += new IrrlichtDevice.EventHandler(Device_OnEvent); irr.Scene.AddCameraSceneNode(); irr.Scene.AddEmptySceneNode(null, PreviewRootNodeId); irr.Scene.AddHillPlaneMesh(PreviewPlateMeshName, new Dimension2Df(PreviewPlateSize), new Dimension2Di(1)); initUI(); openFolder(Path.GetFullPath("../../media")); int lastFPS = -1; while (irr.Device.Run()) { irr.Driver.BeginScene(ClearBufferFlag.All, new Color(0x112233)); irr.Scene.DrawAll(); if (selectedNode == null) { irr.GUI.DrawAll(); } drawScrollPosition(); drawTextureManagerActivity(); drawPreviewPlateTooltip(); irr.Driver.EndScene(); int fps = irr.Driver.FPS; if (lastFPS != fps) { irr.Device.SetWindowCaption(String.Format( "Image Browser - Irrlicht Lime [{0}] fps: {1}", irr.Driver.Name, fps)); lastFPS = fps; } irr.Unlock(); animationManager.Run(); if (wantChangeFolder) { wantChangeFolder = false; string p = irr.GUI.RootElement.GetElementFromID(CurrentFolderStaticTextId).Text; System.Windows.Forms.FolderBrowserDialog d = new System.Windows.Forms.FolderBrowserDialog(); d.SelectedPath = p; if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK && d.SelectedPath != p) { openFolder(d.SelectedPath); } } if (wantUpdateActiveCameraAspectRatio) { wantUpdateActiveCameraAspectRatio = false; irr.Scene.ActiveCamera.AspectRatio = (float)irr.DriverNoCheck.ScreenSize.Width / irr.DriverNoCheck.ScreenSize.Height; } irr.Lock(); } irr.Unlock(); textureManager.Stop(); animationManager.Clear(); irr.Drop(); }
static void Main(string[] args) { irr = new IrrDevice(); irr.CreateDevice(DriverType.Direct3D9, new Dimension2Di(1024, 600)); animationManager = new AnimationManager(irr); textureManager = new TextureManager(irr); textureManager.OnTextureLoaded += new TextureManager.TextureLoadedDelegate(textureManager_OnTextureLoaded); irr.Lock(); irr.Device.SetWindowResizable(true); irr.Device.OnEvent += new IrrlichtDevice.EventHandler(Device_OnEvent); irr.Scene.AddCameraSceneNode(); irr.Scene.AddEmptySceneNode(null, PreviewRootNodeId); irr.Scene.AddHillPlaneMesh(PreviewPlateMeshName, new Dimension2Df(PreviewPlateSize), new Dimension2Di(1)); initUI(); openFolder(Path.GetFullPath("../../media")); int lastFPS = -1; while (irr.Device.Run()) { irr.Driver.BeginScene(true, true, new Color(0x112233)); irr.Scene.DrawAll(); if (selectedNode == null) irr.GUI.DrawAll(); drawScrollPosition(); drawTextureManagerActivity(); drawPreviewPlateTooltip(); irr.Driver.EndScene(); int fps = irr.Driver.FPS; if (lastFPS != fps) { irr.Device.SetWindowCaption(String.Format( "Image Browser - Irrlicht Lime [{0}] fps: {1}", irr.Driver.Name, fps)); lastFPS = fps; } irr.Unlock(); animationManager.Run(); if (wantChangeFolder) { wantChangeFolder = false; string p = irr.GUI.RootElement.GetElementFromID(CurrentFolderStaticTextId).Text; System.Windows.Forms.FolderBrowserDialog d = new System.Windows.Forms.FolderBrowserDialog(); d.SelectedPath = p; if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK && d.SelectedPath != p) { openFolder(d.SelectedPath); } } if (wantUpdateActiveCameraAspectRatio) { wantUpdateActiveCameraAspectRatio = false; irr.Scene.ActiveCamera.AspectRatio = (float)irr.DriverNoCheck.ScreenSize.Width / irr.DriverNoCheck.ScreenSize.Height; } irr.Lock(); } irr.Unlock(); textureManager.Stop(); animationManager.Clear(); irr.Drop(); }