Exemplo n.º 1
0
        private PixelShaderConstant InitializePixelShaderConstantBuffer()
        {
            PixelShaderConstant pixelShaderConstant = new PixelShaderConstant();

            pixelShaderConstant.InnerRadius         = (float)m_configuration.InnerRadius;
            pixelShaderConstant.OuterRadius         = (float)m_configuration.OuterRadius;
            pixelShaderConstant.MagnificationAmount = (float)m_configuration.MagnificationAmount;
            pixelShaderConstant.HorizontalPosition  = (float)m_configuration.HorizontalPosition;
            pixelShaderConstant.VerticalPosition    = (float)m_configuration.VerticalPosition;
            pixelShaderConstant.AspectRatio         = (float)m_configuration.AspectRatio;
            return(pixelShaderConstant);
        }
Exemplo n.º 2
0
        public MagnifySmoothEffectDirect2DWorker(MagnifySmoothEffect configuration)
        {
            InputCount = 1;

            m_configuration = configuration;

            PixelShader = m_configuration.PixelShader;

            PixelShaderConstant pixelShaderConstant = InitializePixelShaderConstantBuffer();

            PixelShaderConstantBuffer = StructureToIBuffer(pixelShaderConstant);
        }
Exemplo n.º 3
0
        private IBuffer StructureToIBuffer(PixelShaderConstant pixelShaderConstant)
        {
            int length = Marshal.SizeOf <PixelShaderConstant>(pixelShaderConstant);

            byte[] pixelShaderConstantArray = new byte[length];

            IntPtr ptr = Marshal.AllocHGlobal(length);

            Marshal.StructureToPtr(pixelShaderConstant, ptr, true);

            Marshal.Copy(ptr, pixelShaderConstantArray, 0, length);

            Marshal.FreeHGlobal(ptr);

            return(pixelShaderConstantArray.AsBuffer());
        }