本文整理汇总了C#中Axiom.Graphics.GpuProgramParameters.GetNamedFloatConstant方法的典型用法代码示例。如果您正苦于以下问题:C# GpuProgramParameters.GetNamedFloatConstant方法的具体用法?C# GpuProgramParameters.GetNamedFloatConstant怎么用?C# GpuProgramParameters.GetNamedFloatConstant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axiom.Graphics.GpuProgramParameters
的用法示例。
在下文中一共展示了GpuProgramParameters.GetNamedFloatConstant方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateUniforms
/// <summary>
/// Updates program object uniforms using data from GpuProgramParameters.
/// normally called by GLSLGpuProgram.BindParameters() just before rendering occurs.
/// </summary>
/// <param name="parameters">GPU Parameters to use to update the uniforms params.</param>
public void UpdateUniforms(GpuProgramParameters parameters)
{
for(int i = 0; i < uniformReferences.Count; i++) {
UniformReference uniformRef = (UniformReference)uniformReferences[i];
GpuProgramParameters.FloatConstantEntry currentFloatEntry = null;
GpuProgramParameters.IntConstantEntry currentIntEntry = null;
if(uniformRef.isFloat) {
currentFloatEntry = parameters.GetNamedFloatConstant(uniformRef.name);
if(currentFloatEntry != null) {
if(currentFloatEntry.isSet) {
switch(uniformRef.elementCount) {
case 1:
Gl.glUniform1fvARB(uniformRef.location, 1, currentFloatEntry.val);
break;
case 2:
Gl.glUniform2fvARB(uniformRef.location, 1, currentFloatEntry.val);
break;
case 3:
Gl.glUniform3fvARB(uniformRef.location, 1, currentFloatEntry.val);
break;
case 4:
Gl.glUniform4fvARB(uniformRef.location, 1, currentFloatEntry.val);
break;
} // end switch
}
}
}
else {
currentIntEntry = parameters.GetNamedIntConstant(uniformRef.name);
if(currentIntEntry != null) {
if(currentIntEntry.isSet) {
switch(uniformRef.elementCount) {
case 1:
Gl.glUniform1ivARB(uniformRef.location, 1, currentIntEntry.val);
break;
case 2:
Gl.glUniform2ivARB(uniformRef.location, 1, currentIntEntry.val);
break;
case 3:
Gl.glUniform3ivARB(uniformRef.location, 1, currentIntEntry.val);
break;
case 4:
Gl.glUniform4ivARB(uniformRef.location, 1, currentIntEntry.val);
break;
} // end switch
}
}
}
}
}