public void SetArrayData(ShaderProgram shader , ShaderUniformName arrayName , ShaderUniformName dataName , IShaderDataOwner provider , int index) { foreach (ShaderUniform uni in shader.uniforms) { if (uni.name == dataName && uni.arrayName == arrayName && uni.arrayIndex == index) { bool set = provider.SetUniform(shader, uni.location, uni.name); if (!set) { Logger.LogError(Logger.ErrorState.Critical, "ShaderUniformManager.SetArrayData. Provider does not have " + GetUniformName(arrayName) + "." + GetUniformName(dataName)); } return; } } Logger.LogError(Logger.ErrorState.Critical, "ShaderUniformManager.SetArrayData. Shader " + shader.programName + " does not use data: " + GetUniformName(arrayName) + "[" + index + "]." + GetUniformName(dataName)); foreach (ShaderUniform uni in shader.uniforms) { if (uni.arrayIndex != -1) { Logger.LogInfo(shader.programName + " uses " + GetUniformName(uni.arrayName) + "[" + uni.arrayIndex + "]." + GetUniformName(uni.name)); } } }
public bool TrySetData(ShaderProgram shader , ShaderUniformName dataName , IShaderDataOwner provider) { bool set = false; foreach (ShaderUniform uni in shader.uniforms) { if (uni.name == dataName) { set = provider.SetUniform(shader, uni.location, uni.name); if (!set) { Logger.LogError(Logger.ErrorState.Critical, "ShaderUniformManager.SetData. Provider does not have " + GetUniformName(dataName)); } break; } } return(set); }