public void ReplaceRenderStates(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformMatrix, Rectangle scissorRectangle) { bool isNewRender = currentParameters.HasValue == false; var newParameters = new BeginParameters(); newParameters.ChangeRecord = StateChangeInfoListPool.GetNextAvailable(); newParameters.ChangeRecord.Clear(); newParameters.SortMode = sortMode; newParameters.BlendState = blendState; newParameters.SamplerState = samplerState; newParameters.DepthStencilState = depthStencilState; newParameters.RasterizerState = rasterizerState; newParameters.Effect = effect; newParameters.TransformMatrix = transformMatrix; try { newParameters.ScissorRectangle = scissorRectangle; } catch (Exception e) { throw new Exception("Could not set scissor rectangle to:" + scissorRectangle.ToString(), e); } if (currentParameters != null) { beginParametersUsedThisFrame.Add(currentParameters.Value); } currentParameters = newParameters; if (beginEndState == SpriteBatchBeginEndState.Began) { SpriteBatch.End(); } try { SpriteBatch.GraphicsDevice.ScissorRectangle = scissorRectangle; } catch (Exception e) { throw new Exception("Error trying to set scissor rectangle:" + scissorRectangle.ToString()); } beginEndState = SpriteBatchBeginEndState.Began; SpriteBatch.Begin(sortMode, blendState, samplerState, depthStencilState, rasterizerState, effect, transformMatrix); }
public void Begin() { var beginParams = new BeginParameters(); beginParams.ChangeRecord = new List <StateChangeInfo>(); beginParams.IsDefault = true; currentParameters = beginParams; if (beginEndState == SpriteBatchBeginEndState.Began) { SpriteBatch.End(); } beginEndState = SpriteBatchBeginEndState.Began; SpriteBatch.Begin(); }
public void Begin() { var beginParams = new BeginParameters(); beginParams.ChangeRecord = StateChangeInfoListPool.GetNextAvailable(); beginParams.ChangeRecord.Clear(); beginParams.IsDefault = true; currentParameters = beginParams; if (beginEndState == SpriteBatchBeginEndState.Began) { SpriteBatch.End(); } beginEndState = SpriteBatchBeginEndState.Began; SpriteBatch.Begin(); }
internal void End() { if (currentParameters != null) { RecordCurrentParameters(); if (beginEndState == SpriteBatchBeginEndState.Began) { SpriteBatch.End(); beginEndState = SpriteBatchBeginEndState.Ended; } } else { if (beginEndState == SpriteBatchBeginEndState.Began) { SpriteBatch.End(); beginEndState = SpriteBatchBeginEndState.Ended; } } }
internal void End() { if (currentParameters != null) { RecordCurrentParameters(); if (beginEndState == SpriteBatchBeginEndState.Began) { SpriteBatch.End(); beginEndState = SpriteBatchBeginEndState.Ended; } } else { if (beginEndState == SpriteBatchBeginEndState.Began) { SpriteBatch.End(); beginEndState = SpriteBatchBeginEndState.Ended; } } }
public void ReplaceRenderStates(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformMatrix, Rectangle scissorRectangle) { bool isNewRender = currentParameters.HasValue == false; var newParameters = new BeginParameters(); newParameters.ChangeRecord = new List<StateChangeInfo>(); newParameters.SortMode = sortMode; newParameters.BlendState = blendState; newParameters.SamplerState = samplerState; newParameters.DepthStencilState = depthStencilState; newParameters.RasterizerState = rasterizerState; newParameters.Effect = effect; newParameters.TransformMatrix = transformMatrix; try { newParameters.ScissorRectangle = scissorRectangle; } catch(Exception e) { throw new Exception("Could not set scissor rectangle to:" + scissorRectangle.ToString(), e); } if (currentParameters != null) { beginParametersUsedThisFrame.Add(currentParameters.Value); } currentParameters = newParameters; if (beginEndState == SpriteBatchBeginEndState.Began) { SpriteBatch.End(); } try { SpriteBatch.GraphicsDevice.ScissorRectangle = scissorRectangle; } catch(Exception e) { throw new Exception("Error trying to set scissor rectangle:" + scissorRectangle.ToString()); } beginEndState = SpriteBatchBeginEndState.Began; SpriteBatch.Begin(sortMode, blendState, samplerState, depthStencilState, rasterizerState, effect, transformMatrix); }
public void Begin() { var beginParams = new BeginParameters(); beginParams.ChangeRecord = new List<StateChangeInfo>(); beginParams.IsDefault = true; currentParameters = beginParams; if (beginEndState == SpriteBatchBeginEndState.Began) { SpriteBatch.End(); } beginEndState = SpriteBatchBeginEndState.Began; SpriteBatch.Begin(); }