public void Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformMatrix, Rectangle scissorRectangle) { bool isNewRender = mLastParameters.HasValue == false; var newParameters = new BeginParameters(); newParameters.SortMode = sortMode; newParameters.BlendState = blendState; newParameters.SamplerState = samplerState; newParameters.DepthStencilState = depthStencilState; newParameters.RasterizerState = rasterizerState; newParameters.Effect = effect; newParameters.TransformMatrix = transformMatrix; newParameters.ScissorRectangle = scissorRectangle; mLastParameters = newParameters; if (!isNewRender) { SpriteBatch.End(); } SpriteBatch.GraphicsDevice.ScissorRectangle = scissorRectangle; SpriteBatch.Begin(sortMode, blendState, samplerState, depthStencilState, rasterizerState, effect, transformMatrix); }
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(); }
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(); }