public void Dispose()
 {
     m_stateBlock.Dispose();
     m_stateBlock = null;
 }
        public void Apply()
        {
            if (m_stateBlock == null)
            {
                m_device.BeginStateBlock();
                m_device.SetRenderState(RenderState.CullMode, CullMode);
                m_device.SetRenderState(RenderState.DepthBias, DepthBias);
                m_device.SetRenderState(RenderState.FillMode, FillMode);
                m_device.SetRenderState(RenderState.MultisampleAntialias, MultiSampleAntiAlias);
                m_device.SetRenderState(RenderState.ScissorTestEnable, ScissorTestEnable);
                m_device.SetRenderState(RenderState.SlopeScaleDepthBias, SlopeScaleDepthBias);
                m_stateBlock = m_device.EndStateBlock();
                m_instances.Add(this);
            }

            m_stateBlock.Apply();

            Current = this;
        }
        public void Apply()
        {
            if (m_stateBlock == null)
            {
                m_device.BeginStateBlock();
                m_device.SetSamplerState(0, SharpDX.Direct3D9.SamplerState.AddressU, AddressU);
                m_device.SetSamplerState(0, SharpDX.Direct3D9.SamplerState.AddressV, AddressV);
                m_device.SetSamplerState(0, SharpDX.Direct3D9.SamplerState.AddressW, AddressW);

                m_device.SetSamplerState(0, SharpDX.Direct3D9.SamplerState.MagFilter, Filter);
                m_device.SetSamplerState(0, SharpDX.Direct3D9.SamplerState.MinFilter, Filter);
                m_device.SetSamplerState(0, SharpDX.Direct3D9.SamplerState.MipFilter, Filter);

                m_device.SetSamplerState(0, SharpDX.Direct3D9.SamplerState.MaxAnisotropy, MaxAnisotropy);
                m_device.SetSamplerState(0, SharpDX.Direct3D9.SamplerState.MaxMipLevel, MaxMipLevel);
                m_device.SetSamplerState(0, SharpDX.Direct3D9.SamplerState.MipMapLodBias, MipMapLevelOfDetailBias);
                m_stateBlock = m_device.EndStateBlock();
                m_instances.Add(this);
            }

            m_stateBlock.Apply();
        }
        public void Apply()
        {
            if (m_stateBlock == null)
            {
                m_device.BeginStateBlock();
                m_device.SetRenderState(RenderState.CcwStencilZFail, CounterClockwiseStencilDepthBufferFail);
                m_device.SetRenderState(RenderState.CcwStencilFail, CounterClockwiseStencilFail);
                m_device.SetRenderState(RenderState.CcwStencilFunc, CounterClockwiseStencilFunction);
                m_device.SetRenderState(RenderState.CcwStencilPass, CounterClockwiseStencilPass);
                m_device.SetRenderState(RenderState.ZEnable, DepthBufferEnable);
                m_device.SetRenderState(RenderState.ZFunc, DepthBufferFunction);
                m_device.SetRenderState(RenderState.ZWriteEnable, DepthBufferWriteEnable);
                m_device.SetRenderState(RenderState.StencilRef, ReferenceStencil);
                m_device.SetRenderState(RenderState.StencilZFail, StencilDepthBufferFail);
                m_device.SetRenderState(RenderState.StencilEnable, StencilEnable);
                m_device.SetRenderState(RenderState.StencilFail, StencilFail);
                m_device.SetRenderState(RenderState.StencilFunc, StencilFunction);
                m_device.SetRenderState(RenderState.StencilMask, StencilMask);
                m_device.SetRenderState(RenderState.StencilPass, StencilPass);
                m_device.SetRenderState(RenderState.StencilWriteMask, StencilWriteMask);
                m_device.SetRenderState(RenderState.TwoSidedStencilMode, TwoSidedStencilMode);
                m_stateBlock = m_device.EndStateBlock();
                m_instances.Add(this);
            }

            m_stateBlock.Apply();

            Current = this;
        }
Example #5
0
        public void Apply()
        {
            if (m_stateBlock == null)
            {
                m_device.BeginStateBlock();

                m_device.SetRenderState(RenderState.AlphaBlendEnable, true);
                m_device.SetRenderState(RenderState.AlphaFunc, Compare.Always);

                m_device.SetRenderState(RenderState.BlendOperationAlpha, AlphaBlendFunction);
                m_device.SetRenderState(RenderState.DestinationBlendAlpha, AlphaDestinationBlend);
                m_device.SetRenderState(RenderState.SourceBlendAlpha, AlphaSourceBlend);
                m_device.SetRenderState(RenderState.BlendFactor, BlendFactor.ToRgba());
                m_device.SetRenderState(RenderState.BlendOperation, ColorBlendFunction);
                m_device.SetRenderState(RenderState.DestinationBlend, ColorDestinationBlend);
                m_device.SetRenderState(RenderState.SourceBlend, ColorSourceBlend);

                m_device.SetRenderState(RenderState.ColorWriteEnable, ColorWriteChannels);
                m_device.SetRenderState(RenderState.ColorWriteEnable1, ColorWriteChannels1);
                m_device.SetRenderState(RenderState.ColorWriteEnable2, ColorWriteChannels2);
                m_device.SetRenderState(RenderState.ColorWriteEnable3, ColorWriteChannels3);

                m_stateBlock = m_device.EndStateBlock();
                m_instances.Add(this);
            }
 
            m_stateBlock.Apply();

            Current = this;
        }