static void Main( string[] _args ) { //_args = new string[] { @"..\..\..\Arkane\BImages\stainedglass2_area.bimage7" }; _args = new string[] { @"..\..\..\Arkane\CubeMaps\dust_return\pr_obe_1127_cube_BC6H_UF16.bimage" }; if ( _args.Length != 1 ) { MessageBox.Show( "Missing filename argument! Can't open unspecified file...", "BImage Viewer" ); return; } System.IO.FileInfo ImageFileName = new System.IO.FileInfo( _args[0] ); if ( !ImageFileName.Exists ) { MessageBox.Show( "Specified image name \"" + _args[1] + "\" not found on disk!", "BImage Viewer" ); return; } BImage Image = null; try { Image = new BImage( ImageFileName ); } catch ( Exception _e ) { MessageBox.Show( "An error occurred while loading bimage \"" + ImageFileName.FullName + "\":\r\n" + _e.Message, "BImage Viewer" ); return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault( false ); Application.Run( new ViewerForm( Image ) ); }
static void Main(string[] _args) { //_args = new string[] { @"..\..\..\Arkane\BImages\stainedglass2_area.bimage7" }; _args = new string[] { @"..\..\..\Arkane\CubeMaps\dust_return\pr_obe_1127_cube_BC6H_UF16.bimage" }; if (_args.Length != 1) { MessageBox.Show("Missing filename argument! Can't open unspecified file...", "BImage Viewer"); return; } System.IO.FileInfo ImageFileName = new System.IO.FileInfo(_args[0]); if (!ImageFileName.Exists) { MessageBox.Show("Specified image name \"" + _args[1] + "\" not found on disk!", "BImage Viewer"); return; } BImage Image = null; try { Image = new BImage(ImageFileName); } catch (Exception _e) { MessageBox.Show("An error occurred while loading bimage \"" + ImageFileName.FullName + "\":\r\n" + _e.Message, "BImage Viewer"); return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new ViewerForm(Image)); }
// Primitive m_Prim_Cube; public ViewerForm(BImage _Image) { InitializeComponent(); //TransparencyKey = SystemColors.Control; // Setup device m_Device = new Device(); m_Device.Init(Handle, false, true); m_CB_Global = new ConstantBuffer <CB_Global>(m_Device, 0); // Create shaders m_Shader_Render2D = new Shader(m_Device, new ShaderFile(new System.IO.FileInfo(@"./Shaders/Render2D.hlsl")), VERTEX_FORMAT.Pt4, "VS", null, "PS", null); // Create the texture try { if (_Image.m_Opts.m_type == BImage.ImageOptions.TYPE.TT_2D) { m_Tex2D = _Image.CreateTexture2D(m_Device); m_CB_Global.m.m_ImageWidth = (uint)m_Tex2D.Width; m_CB_Global.m.m_ImageHeight = (uint)m_Tex2D.Height; m_CB_Global.m.m_ImageDepth = (uint)m_Tex2D.ArraySize; m_CB_Global.m.m_ImageType = 0; integerTrackbarControlMipLevel.RangeMax = m_Tex2D.MipLevelsCount; integerTrackbarControlMipLevel.VisibleRangeMax = m_Tex2D.MipLevelsCount; } else if (_Image.m_Opts.m_type == BImage.ImageOptions.TYPE.TT_CUBIC) { m_TexCube = _Image.CreateTextureCube(m_Device); m_CB_Global.m.m_ImageWidth = (uint)m_TexCube.Width; m_CB_Global.m.m_ImageHeight = (uint)m_TexCube.Height; m_CB_Global.m.m_ImageDepth = (uint)m_TexCube.ArraySize; m_CB_Global.m.m_ImageType = 1; integerTrackbarControlMipLevel.RangeMax = m_TexCube.MipLevelsCount; integerTrackbarControlMipLevel.VisibleRangeMax = m_TexCube.MipLevelsCount; } else if (_Image.m_Opts.m_type == BImage.ImageOptions.TYPE.TT_3D) { m_Tex3D = _Image.CreateTexture3D(m_Device); } // Enable EV manipulation for HDR images bool showExposure = _Image.m_Opts.m_format.m_type == BImage.PixelFormat.Type.FLOAT; labelEV.Visible = showExposure; floatTrackbarControlEV.Visible = showExposure; } catch (Exception _e) { MessageBox.Show(this, "Failed to create a valid texture from the image:\r\n\r\n" + _e.Message, "BImage Viewer", MessageBoxButtons.OK, MessageBoxIcon.Error); } Application.Idle += new EventHandler(Application_Idle); }
// Primitive m_Prim_Cube; public ViewerForm( BImage _Image ) { InitializeComponent(); //TransparencyKey = SystemColors.Control; // Setup device m_Device = new Device(); m_Device.Init( Handle, false, true ); m_CB_Global = new ConstantBuffer< CB_Global >( m_Device, 0 ); // Create shaders m_Shader_Render2D = new Shader( m_Device, new ShaderFile( new System.IO.FileInfo( @"./Shaders/Render2D.hlsl" ) ), VERTEX_FORMAT.Pt4, "VS", null, "PS", null ); // Create the texture try { if ( _Image.m_Opts.m_type == BImage.ImageOptions.TYPE.TT_2D ) { m_Tex2D = _Image.CreateTexture2D( m_Device ); m_CB_Global.m.m_ImageWidth = (uint) m_Tex2D.Width; m_CB_Global.m.m_ImageHeight = (uint) m_Tex2D.Height; m_CB_Global.m.m_ImageDepth = (uint) m_Tex2D.ArraySize; m_CB_Global.m.m_ImageType = 0; integerTrackbarControlMipLevel.RangeMax = m_Tex2D.MipLevelsCount; integerTrackbarControlMipLevel.VisibleRangeMax = m_Tex2D.MipLevelsCount; } else if ( _Image.m_Opts.m_type == BImage.ImageOptions.TYPE.TT_CUBIC ) { m_TexCube = _Image.CreateTextureCube( m_Device ); m_CB_Global.m.m_ImageWidth = (uint) m_TexCube.Width; m_CB_Global.m.m_ImageHeight = (uint) m_TexCube.Height; m_CB_Global.m.m_ImageDepth = (uint) m_TexCube.ArraySize; m_CB_Global.m.m_ImageType = 1; integerTrackbarControlMipLevel.RangeMax = m_TexCube.MipLevelsCount; integerTrackbarControlMipLevel.VisibleRangeMax = m_TexCube.MipLevelsCount; } else if ( _Image.m_Opts.m_type == BImage.ImageOptions.TYPE.TT_3D ) { m_Tex3D = _Image.CreateTexture3D( m_Device ); } // Enable EV manipulation for HDR images bool showExposure = _Image.m_Opts.m_format.m_type == BImage.PixelFormat.Type.FLOAT; labelEV.Visible = showExposure; floatTrackbarControlEV.Visible = showExposure; } catch ( Exception _e ) { MessageBox.Show( this, "Failed to create a valid texture from the image:\r\n\r\n" + _e.Message, "BImage Viewer", MessageBoxButtons.OK, MessageBoxIcon.Error ); } Application.Idle += new EventHandler( Application_Idle ); }
public ImageSlice( BImage _Owner, BinaryReader _R, uint _MipOffset ) { m_Owner = _Owner; Read( _R, _MipOffset ); }
public ImageSlice(BImage _Owner, BinaryReader _R, uint _MipOffset) { m_Owner = _Owner; Read(_R, _MipOffset); }