public void SetRenderState(IEffectTechnique technique, int passIndex, RenderState rs) { RenderStateRecord[] records; if (!_map.TryGetValue(technique.Name, out records)) { records = new RenderStateRecord[technique.Passes.Count]; _map.Add(technique.Name, records); } if (passIndex >= 0 && passIndex < records.Length) { RenderStateRecord record = records[passIndex]; switch (rs.StateType) { case RenderStateType.BlendState: record.BlendState = rs as BlendState; break; case RenderStateType.DepthStencilState: record.DepthStencilState = rs as DepthStencilState; break; case RenderStateType.RasterizerState: record.RasterizerState = rs as RasterizerState; break; } records[passIndex] = record; } else { throw new ArgumentOutOfRangeException("Pass index out of range"); } }
public RenderState GetRenderState(RenderStateType type, String techName, int passIndex) { RenderStateRecord[] records; if (!_map.TryGetValue(techName, out records)) { return(null); } if (passIndex >= 0 && passIndex < records.Length) { RenderStateRecord record = records[passIndex]; switch (type) { case RenderStateType.BlendState: return(record.BlendState); case RenderStateType.DepthStencilState: return(record.DepthStencilState); case RenderStateType.RasterizerState: return(record.RasterizerState); default: return(null); } } else { throw new ArgumentOutOfRangeException("Pass index out of range"); } }
public void ApplyRenderStates(IRenderer renderer, int passIndex) { if (_activeRecords != null) { if (passIndex >= 0 && passIndex < _activeRecords.Length) { RenderStateRecord record = _activeRecords[passIndex]; renderer.ApplyRenderState(RenderStateType.BlendState, record.BlendState); renderer.ApplyRenderState(RenderStateType.DepthStencilState, record.DepthStencilState); renderer.ApplyRenderState(RenderStateType.RasterizerState, record.RasterizerState); } } // fail silently }