Esempio n. 1
0
        void OnResizedSwapChain(int width, int height, float fovy)
        {
            // Recalculate buffer sizes
            m_BBWidth  = width / 2;
            m_BBHeight = height / 2;


            RecompileShader();
            UpdateDirs();

            // Create the RT
            Texture2DDescription pDesc = new Texture2DDescription();

            pDesc.Width     = m_BBWidth;
            pDesc.Height    = m_BBHeight;
            pDesc.MipLevels = 1;
            pDesc.ArraySize = 1;
            pDesc.Format    = Format.R8G8B8A8_UNorm;
            //pDesc.Format = Format.R8_UNorm;
            pDesc.SampleDescription = new SampleDescription(1, 0);
            pDesc.Usage             = ResourceUsage.Default;
            pDesc.BindFlags         = BindFlags.ShaderResource | BindFlags.RenderTarget;
            pDesc.CpuAccessFlags    = CpuAccessFlags.None;
            pDesc.OptionFlags       = ResourceOptionFlags.None;

            //SAFE_DELETE(m_SSAOBuffer);
            MSsaoBuffer = new SimpleRT(m_D3DDevice, pDesc);

            // tanf ?? using normal tan (probl tangent float
            m_FocalLen[0]      = 1.0f / (float)Math.Tan(fovy * 0.5f) * (float)m_BBHeight / (float)m_BBWidth;
            m_FocalLen[1]      = 1.0f / (float)Math.Tan(fovy * 0.5f);
            m_InvFocalLen[0]   = 1.0f / m_FocalLen[0];
            m_InvFocalLen[1]   = 1.0f / m_FocalLen[1];
            m_InvResolution[0] = 1.0f / m_BBWidth;
            m_InvResolution[1] = 1.0f / m_BBHeight;
            m_Resolution[0]    = (float)m_BBWidth;
            m_Resolution[1]    = (float)m_BBHeight;

            m_pFocalLen.Set(m_FocalLen);
            m_pInvFocalLen.Set(m_InvFocalLen);
            m_pInvResolution.Set(m_InvResolution);
            m_pResolution.Set(m_Resolution);

            m_Viewport.X      = 0;
            m_Viewport.Y      = 0;
            m_Viewport.MinZ   = 0;
            m_Viewport.MaxZ   = 1;
            m_Viewport.Width  = m_BBWidth;
            m_Viewport.Height = m_BBHeight;
        }
Esempio n. 2
0
        void initialize()
        {
            m_BBWidth  = 0;
            m_BBHeight = 0;

            m_Effect      = null;
            MSsaoBuffer   = null;
            m_pRndTexture = null;
            m_pRndTexSRV  = null;

            m_RadiusMultiplier = 1.0f;
            m_AngleBias        = 30;
            m_NumDirs          = 16;
            m_NumSteps         = 3;
            m_Contrast         = 1.25f;
            m_Attenuation      = 1.0f;
            m_QualityMode      = 1;
            m_AORadius         = 0.001f;
        }