public void Init() { #if !DEBUG using ( ScopedForceMaterialsLoadFromBinary scope = new ScopedForceMaterialsLoadFromBinary() ) #endif { m_PS_Display = new Shader( Device, new System.IO.FileInfo( "./Shaders/Display.hlsl" ), VERTEX_FORMAT.Pt4, "VS", null, "PS", null ); } m_CB_Display = new ConstantBuffer<CBDisplay>( Device, 0 ); m_CB_Display.m._Width = (uint) Width; m_CB_Display.m._Height = (uint) Height; // Setup camera m_Camera.CreatePerspectiveCamera( (float) (60.0 * Math.PI / 180.0), (float) Width / Height, 0.01f, 100.0f ); m_Manipulator.Attach( this, m_Camera ); m_Manipulator.InitializeCamera( new float3( 0, -0.1f, 0.1f ), new float3( 0, 0, 0 ), float3.UnitY ); m_Manipulator.ManipulationPanSpeed = 0.1f; m_Camera.CameraTransformChanged += new EventHandler( Camera_CameraTransformChanged ); m_Manipulator.EnableMouseAction += new CameraManipulator.EnableMouseActionEventHandler( m_Manipulator_EnableMouseAction ); Camera_CameraTransformChanged( m_Manipulator, EventArgs.Empty ); Application.Idle += new EventHandler( Application_Idle ); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { m_device.Init( m_viewerForm.Handle, false, true ); // Create our compute shaders #if !DEBUG using ( ScopedForceMaterialsLoadFromBinary scope = new ScopedForceMaterialsLoadFromBinary() ) #endif { m_CS_BilateralFilter = new ComputeShader( m_device, new System.IO.FileInfo( "./Shaders/BilateralFiltering.hlsl" ), "CS", null ); m_CS_GenerateSSBumpMap = new ComputeShader( m_device, new System.IO.FileInfo( "./Shaders/GenerateSSBumpMap.hlsl" ), "CS", null ); m_PS_Display = new Shader( m_device, new System.IO.FileInfo( "./Shaders/Display.hlsl" ), VERTEX_FORMAT.Pt4, "VS", null, "PS", null ); } // Create our constant buffers m_CB_Input = new ConstantBuffer<CBInput>( m_device, 0 ); m_CB_Filter = new ConstantBuffer<CBFilter>( m_device, 0 ); m_CB_Display = new ConstantBuffer<CBDisplay>( m_device, 0 ); m_CB_Display.m._Width = (uint) m_viewerForm.Width; m_CB_Display.m._Height = (uint) m_viewerForm.Height; // Create our structured buffer containing the rays m_SB_Rays = new StructuredBuffer<float3>( m_device, 3*MAX_THREADS, true ); integerTrackbarControlRaysCount_SliderDragStop( integerTrackbarControlRaysCount, 0 ); // LoadHeightMap( new System.IO.FileInfo( "eye_generic_01_disp.png" ) ); // LoadHeightMap( new System.IO.FileInfo( "10 - Smooth.jpg" ) ); } catch ( Exception _e ) { MessageBox( "Failed to create DX11 device and default shaders:\r\n", _e ); Close(); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { m_Device.Init( m_viewerForm.Handle, false, true ); m_viewerForm.Init(); // Create our compute shaders #if !DEBUG || BISOU using ( ScopedForceMaterialsLoadFromBinary scope = new ScopedForceMaterialsLoadFromBinary() ) #endif { m_CS_BilateralFilter = new ComputeShader( m_Device, new System.IO.FileInfo( "./Shaders/BilateralFiltering.hlsl" ), "CS", null ); m_CS_GenerateVisibilityMap = new ComputeShader( m_Device, new System.IO.FileInfo( "./Shaders/GenerateVisibilityMap.hlsl" ), "CS", null ); m_CS_GenerateTranslucencyMap = new ComputeShader( m_Device, new System.IO.FileInfo( "./Shaders/GenerateTranslucencyMap.hlsl" ), "CS", null ); m_CS_Helper_Normalize = new ComputeShader( m_Device, new System.IO.FileInfo( "./Shaders/Helpers.hlsl" ), "CS_Finalize", null ); m_CS_Helper_Mix = new ComputeShader( m_Device, new System.IO.FileInfo( "./Shaders/Helpers.hlsl" ), "CS_Mix", null ); } // m_CS_BilateralFilter = new ComputeShader( m_Device, new ShaderBinaryFile( new System.IO.FileInfo( "./Shaders/Binary/BilateralFiltering.fxbin" ) ), "CS" ); // m_CS_GenerateVisibilityMap = new ComputeShader( m_Device, new ShaderBinaryFile( new System.IO.FileInfo( "./Shaders/Binary/GenerateVisibilityMap.fxbin" ) ), "CS" ); // m_CS_GenerateTranslucencyMap = new ComputeShader( m_Device, new ShaderBinaryFile( new System.IO.FileInfo( "./Shaders/Binary/GenerateTranslucencyMap.fxbin" ) ), "CS" ); // m_CS_Helper_Normalize = new ComputeShader( m_Device, new ShaderBinaryFile( new System.IO.FileInfo( "./Shaders/Helpers.hlsl" ) ), "CS_Finalize" ); // m_CS_Helper_Mix = new ComputeShader( m_Device, new ShaderBinaryFile( new System.IO.FileInfo( "./Shaders/Helpers.hlsl" ) ), "CS_Mix" ); // Create our constant buffers m_CB_Generate = new ConstantBuffer<CBGenerate>( m_Device, 0 ); m_CB_Visibility = new ConstantBuffer<CBVisibility>( m_Device, 0 ); m_CB_Filter = new ConstantBuffer<CBFilter>( m_Device, 0 ); m_CB_Helper = new ConstantBuffer<CBHelper>( m_Device, 0 ); // Create the rays integerTrackbarControlRaysCount_SliderDragStop( integerTrackbarControlRaysCount, 0 ); } catch ( Exception _e ) { MessageBox( "Failed to create DX11 device and default shaders:\r\n", _e ); Close(); } // LoadThicknessMap( new System.IO.FileInfo( "Leaf_thickness.tga" ) ); // LoadNormalMap( new System.IO.FileInfo( "Leaf_normal.tga" ) ); // LoadAlbedoMap( new System.IO.FileInfo( "Leaf_albedo.tga" ) ); // LoadTransmittanceMap( new System.IO.FileInfo( "Leaf_transmittance.tga" ) ); //LoadResults( new System.IO.FileInfo( "Leaf_thickness.tga" ) ); }