当前位置: 首页>>代码示例>>C#>>正文


C# GpuProgramParameters.GetIntConstant方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:79,代码来源:D3DRenderSystem.cs

示例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]);
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:8,代码来源:D3D9RenderSystem.cs

示例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;
            }
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:53,代码来源:D3D9RenderSystem.cs

示例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;
 }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:23,代码来源:D3D9RenderSystem.cs


注:本文中的Axiom.Graphics.GpuProgramParameters.GetIntConstant方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。