本文整理汇总了C#中Axiom.Graphics.GpuProgramParameters.GetIntConstant方法的典型用法代码示例。如果您正苦于以下问题:C# GpuProgramParameters.GetIntConstant方法的具体用法?C# GpuProgramParameters.GetIntConstant怎么用?C# GpuProgramParameters.GetIntConstant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axiom.Graphics.GpuProgramParameters
的用法示例。
在下文中一共展示了GpuProgramParameters.GetIntConstant方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindGpuProgramParameters
public override void BindGpuProgramParameters(GpuProgramType gptype, GpuProgramParameters parms, GpuProgramParameters.GpuParamVariability variability)
{
// special case pass iteration
if (variability == GpuProgramParameters.GpuParamVariability.PassIterationNumber)
{
BindGpuProgramPassIterationParameters(gptype);
return;
}
if ((variability & GpuProgramParameters.GpuParamVariability.Global) != 0)
{
// D3D9 doesn't support shared constant buffers, so use copy routine
parms.CopySharedParams();
}
switch ( gptype )
{
case GpuProgramType.Vertex:
activeVertexGpuProgramParameters = parms;
if ( parms.HasFloatConstants )
{
for ( var index = 0; index < parms.FloatConstantCount; index++ )
{
var entry = parms.GetFloatConstant( index );
if ( entry.isSet )
{
ActiveD3D9Device.SetVertexShaderConstant(index, entry.val, 0, 1);
}
}
}
if (parms.HasIntConstants)
{
for (var index = 0; index < parms.IntConstantCount; index++)
{
var entry = parms.GetIntConstant(index);
if (entry.isSet)
{
ActiveD3D9Device.SetVertexShaderConstant(index, entry.val, 0, 1);
}
}
}
break;
case GpuProgramType.Fragment:
activeFragmentGpuProgramParameters = parms;
if (parms.HasFloatConstants)
{
for (var index = 0; index < parms.FloatConstantCount; index++)
{
var entry = parms.GetFloatConstant(index);
if (entry.isSet)
{
ActiveD3D9Device.SetPixelShaderConstant(index, entry.val, 0, 1);
}
}
}
if ( parms.HasIntConstants )
{
for ( var index = 0; index < parms.IntConstantCount; index++ )
{
var entry = parms.GetIntConstant( index );
if ( entry.isSet )
{
ActiveD3D9Device.SetPixelShaderConstant(index, entry.val, 0, 1);
}
}
}
break;
}
}
示例2: IntConstantDifferentFromCache
protected bool IntConstantDifferentFromCache(GpuProgramParameters parms, Object[] intConstants, int index)
{
GpuProgramParameters.IntConstantEntry e = parms.GetIntConstant(index);
if (!e.isSet)
return false;
int[] c = (int[])intConstants[index];
return c == null || !(c[0] == e.val[0] && c[1] == e.val[1] && c[2] == e.val[2] && c[3] == e.val[3]);
}
示例3: BindGpuProgramParameters
public override void BindGpuProgramParameters(GpuProgramType type, GpuProgramParameters parms)
{
switch(type) {
case GpuProgramType.Vertex:
if(parms.HasIntConstants) {
if (cache.useConstantCache) {
foreach (IntArrayAndOffset arrayAndOffset in GetIntConstantArrays(parms, cache.intShaderConstants))
device.SetVertexShaderConstant(arrayAndOffset.offset, arrayAndOffset.array);
}
else {
for(int index = 0; index < parms.IntConstantCount; index++) {
GpuProgramParameters.IntConstantEntry entry = parms.GetIntConstant(index);
if(entry.isSet)
device.SetVertexShaderConstant(index, entry.val);
}
}
}
if(parms.HasFloatConstants) {
if (cache.useConstantCache) {
foreach (FloatArrayAndOffset arrayAndOffset in GetFloatConstantArrays(parms, cache.floatShaderConstants))
device.SetVertexShaderConstant(arrayAndOffset.offset, arrayAndOffset.array);
}
else
device.SetVertexShaderConstant(0, parms.floatConstantsArray);
}
break;
case GpuProgramType.Fragment:
if(parms.HasIntConstants) {
if (cache.useConstantCache) {
foreach (IntArrayAndOffset arrayAndOffset in GetIntConstantArrays(parms, cache.intPixelConstants))
device.SetPixelShaderConstant(arrayAndOffset.offset, arrayAndOffset.array);
}
else {
for(int index = 0; index < parms.IntConstantCount; index++) {
GpuProgramParameters.IntConstantEntry entry = parms.GetIntConstant(index);
if(entry.isSet)
device.SetPixelShaderConstant(index, entry.val);
}
}
}
if(parms.HasFloatConstants) {
if (cache.useConstantCache) {
foreach (FloatArrayAndOffset arrayAndOffset in GetFloatConstantArrays(parms, cache.floatPixelConstants))
device.SetPixelShaderConstant(arrayAndOffset.offset, arrayAndOffset.array);
}
else
device.SetPixelShaderConstant(0, parms.floatConstantsArray);
}
break;
}
}
示例4: GetIntConstantArrayStartingWith
protected int[] GetIntConstantArrayStartingWith(GpuProgramParameters parms, Object[] intConstants, int firstIndex, int count)
{
int[] array = new int[count * 4];
for (int i = 0; i < count; i++) {
GpuProgramParameters.IntConstantEntry e = parms.GetIntConstant(firstIndex + i);
if (!e.isSet) {
for (int j=0; j<4; j++)
array[i * 4 + j] = 0;
}
else {
for (int j=0; j<4; j++)
array[i * 4 + j] = e.val[j];
}
int[] cacheConstant = (int[])intConstants[firstIndex + i];
if (cacheConstant == null) {
cacheConstant = new int[4];
intConstants[firstIndex + i] = cacheConstant;
}
for (int j=0; j<4; j++)
cacheConstant[j] = array[i * 4 + j];
}
return array;
}