本文整理汇总了C#中ShaderProgram.ResetTextureUnits方法的典型用法代码示例。如果您正苦于以下问题:C# ShaderProgram.ResetTextureUnits方法的具体用法?C# ShaderProgram.ResetTextureUnits怎么用?C# ShaderProgram.ResetTextureUnits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShaderProgram
的用法示例。
在下文中一共展示了ShaderProgram.ResetTextureUnits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Apply
/// <summary>
/// Apply the set of GraphicsState collected by this instance.
/// </summary>
/// <param name="ctx">
/// A <see cref="GraphicsContext"/> defining the state vector.
/// </param>
/// <param name="program">
/// A <see cref="ShaderProgram"/> defining the uniform state.
/// </param>
/// <param name="currentStateSet">
///
/// </param>
private void Apply(GraphicsContext ctx, ShaderProgram program, GraphicsStateSet currentStateSet)
{
if (ctx == null)
throw new ArgumentNullException("ctx");
// Reset texture unit state
if (program != null)
program.ResetTextureUnits();
// Apply known states
foreach (KeyValuePair<string, IGraphicsState> pair in mRenderStates) {
IGraphicsState state = pair.Value;
if (state.IsContextBound && (currentStateSet != null) && (currentStateSet.IsDefinedState(state.StateIdentifier))) {
IGraphicsState currentState = currentStateSet[state.StateIdentifier];
if (currentState.Inheritable && state.Equals(currentState))
continue;
}
// Apply state if the state is context-bound, or a shader is currently in use
if ((program != null) || (state.IsContextBound))
state.ApplyState(ctx, program);
}
// Apply custom states, if any
foreach (GraphicsState customState in mCustomStates) {
if ((program != null) || (customState.IsContextBound))
customState.ApplyState(ctx, program);
}
}