コード例 #1
0
ファイル: StageStatus.cs プロジェクト: h78hy78yhoi8j/xenko
        public void Apply(GraphicsDevice graphicsDevice, EffectParameterResourceBinding[] bindings, EffectParameterCollectionGroup parameterCollectionGroup, ref EffectStateBindings effectStateBindings, bool applyEffectStates)
        {
            // Apply shader parameters
            for (int i = 0; i < bindings.Length; i++)
            {
                bindings[i].ApplyParameterWithUpdater(graphicsDevice, ref bindings[i].Description, parameterCollectionGroup);
            }

            if (applyEffectStates)
            {
                // Apply graphics states
                var rasterizerState = parameterCollectionGroup.GetValue<RasterizerState>(effectStateBindings.RasterizerStateKeyIndex);
                if (rasterizerState != null)
                {
                    graphicsDevice.SetRasterizerState(rasterizerState);
                }

                var depthStencilState = parameterCollectionGroup.GetValue<DepthStencilState>(effectStateBindings.DepthStencilStateKeyIndex);
                if (depthStencilState != null)
                {
                    graphicsDevice.SetDepthStencilState(depthStencilState);
                }

                var blendState = parameterCollectionGroup.GetValue<BlendState>(effectStateBindings.BlendStateKeyIndex);
                if (blendState != null)
                {
                    graphicsDevice.SetBlendState(blendState);
                }
            }
        }
コード例 #2
0
ファイル: StageStatus.cs プロジェクト: sonicviz/xenko
        public void Apply(GraphicsDevice graphicsDevice, EffectParameterResourceBinding[] bindings, EffectParameterCollectionGroup parameterCollectionGroup, ref EffectStateBindings effectStateBindings, bool applyEffectStates)
        {
            // Apply shader parameters
            for (int i = 0; i < bindings.Length; i++)
            {
                bindings[i].ApplyParameterWithUpdater(graphicsDevice, ref bindings[i].Description, parameterCollectionGroup);
            }

            if (applyEffectStates)
            {
                // Apply graphics states
                var rasterizerState = parameterCollectionGroup.GetValue <RasterizerState>(effectStateBindings.RasterizerStateKeyIndex);
                if (rasterizerState != null)
                {
                    graphicsDevice.SetRasterizerState(rasterizerState);
                }

                var depthStencilState = parameterCollectionGroup.GetValue <DepthStencilState>(effectStateBindings.DepthStencilStateKeyIndex);
                if (depthStencilState != null)
                {
                    graphicsDevice.SetDepthStencilState(depthStencilState);
                }

                var blendState = parameterCollectionGroup.GetValue <BlendState>(effectStateBindings.BlendStateKeyIndex);
                if (blendState != null)
                {
                    graphicsDevice.SetBlendState(blendState);
                }
            }
        }