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); } } }
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); } } }