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


C# GpuProgramParameters.GetFloatConstant方法代码示例

本文整理汇总了C#中Axiom.Graphics.GpuProgramParameters.GetFloatConstant方法的典型用法代码示例。如果您正苦于以下问题:C# GpuProgramParameters.GetFloatConstant方法的具体用法?C# GpuProgramParameters.GetFloatConstant怎么用?C# GpuProgramParameters.GetFloatConstant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Axiom.Graphics.GpuProgramParameters的用法示例。


在下文中一共展示了GpuProgramParameters.GetFloatConstant方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetConstantFloatArray

        public void SetConstantFloatArray()
        {
            float[] expected = new[] { (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom() };
            float[] actual;

            GpuProgramParameters parameters = new GpuProgramParameters();
            //var floatLogical = new GpuLogicalBufferStruct();
            //parameters._setLogicalIndexes( floatLogical, new GpuLogicalBufferStruct() );
            parameters.SetConstant( 0, expected );

            Assert.IsTrue( parameters.GetFloatConstant( 0 ).isSet );
            actual = parameters.GetFloatConstant( 0 ).val;
            Assert.AreEqual( expected, actual );
        }
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:14,代码来源:GpuProgramParametersTestFixture.cs

示例2: BindParameters

        /// <summary>
        ///     Binds named parameters to fp30 programs.
        /// </summary>
        /// <param name="parms"></param>
        public override void BindParameters(GpuProgramParameters parms)
        {
            if(parms.HasFloatConstants) {
                for(int index = 0; index < parms.FloatConstantCount; index++) {
                    string name = parms.GetNameByIndex(index);

                    if(name != null) {
                        GpuProgramParameters.FloatConstantEntry entry = parms.GetFloatConstant(index);

                        // send the params 4 at a time
                        Gl.glProgramNamedParameter4fvNV(programId, name.Length, name, entry.val);
                    }
                }
            }
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:19,代码来源:NV3xGpuProgram.cs

示例3: BindParameters

        /// <summary>
        ///     Called to pass parameters to the Nvparse program.
        /// </summary>
        /// <param name="parms"></param>
        public override void BindParameters(GpuProgramParameters parms)
        {
            // Register combiners uses 2 constants per texture stage (0 and 1)
            // We have stored these as (stage * 2) + const_index
            if(parms.HasFloatConstants) {
                for(int index = 0; index < parms.FloatConstantCount; index++) {
                    GpuProgramParameters.FloatConstantEntry entry = parms.GetFloatConstant(index);

                    if(entry.isSet) {
                        int combinerStage = Gl.GL_COMBINER0_NV + (index / 2);
                        int pname = Gl.GL_CONSTANT_COLOR0_NV + (index % 2);

                        // send the params 4 at a time
                        Gl.glCombinerStageParameterfvNV(combinerStage, pname, entry.val);
                    }
                }
            }
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:22,代码来源:NvparseFragmentProgram.cs

示例4: SetConstantMatrix4

        public void SetConstantMatrix4()
        {
            float[] expected = new[] {  (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(),
                                        (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(),
                                        (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(),
                                        (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom() };

            float[] actual = new float[16];

            GpuProgramParameters parameters = new GpuProgramParameters();
            //var floatLogical = new GpuLogicalBufferStruct();
            //parameters._setLogicalIndexes( floatLogical, new GpuLogicalBufferStruct() );
            parameters.SetConstant( 0, new Matrix4( expected[ 0 ],  expected[ 1 ],  expected[ 2 ],  expected[ 3 ],
                                                    expected[ 4 ],  expected[ 5 ],  expected[ 6 ],  expected[ 7 ],
                                                    expected[ 8 ],  expected[ 9 ],  expected[ 10 ], expected[ 11 ],
                                                    expected[ 12 ], expected[ 13 ], expected[ 14 ], expected[ 15 ] ) );

            GpuProgramParameters.FloatConstantEntry fcEntry;
            for (int i = 0; i < 4; i++)
            {
                fcEntry = parameters.GetFloatConstant(i);
                Assert.IsTrue(fcEntry.isSet);

                fcEntry.val.CopyTo(actual, i * 4);
            }

            Assert.AreEqual( expected, actual );
        }
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:28,代码来源:GpuProgramParametersTestFixture.cs

示例5: 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

示例6: BindProgramParameters

        public override void BindProgramParameters(GpuProgramParameters parms, GpuProgramParameters.GpuParamVariability mask)
		{
			if ( !IsSupported )
				return;
			if ( parms.HasFloatConstants )
			{
				for ( int index = 0; index < parms.FloatConstantCount; index++ )
				{
					GpuProgramParameters.FloatConstantEntry entry = parms.GetFloatConstant( index );

					if ( entry.isSet )
					{
						// MONO: the 4fv version does not work
						float[] vals = entry.val;
						Gl.glProgramLocalParameter4fARB( programType, index, vals[ 0 ], vals[ 1 ], vals[ 2 ], vals[ 3 ] );
					}
				}
			}
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:19,代码来源:ARBGpuProgram.cs

示例7: BindProgramParameters

        public override void BindProgramParameters(GpuProgramParameters parms, GpuProgramParameters.GpuParamVariability mask)
		{
			// program constants done internally by compiler for local
			if ( parms.HasFloatConstants )
			{
				for ( int index = 0; index < parms.FloatConstantCount; index++ )
				{
					GpuProgramParameters.FloatConstantEntry entry = parms.GetFloatConstant( index );

					if ( entry.isSet )
					{
						// send the params 4 at a time
						Gl.glSetFragmentShaderConstantATI( Gl.GL_CON_0_ATI + index, entry.val );
					}
				}
			}
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:17,代码来源:ATIFragmentShaderGpuProgram.cs

示例8: BindProgramParameters

		/// <summary>
		///     Binds named parameters to fp30 programs.
		/// </summary>
		/// <param name="parms"></param>
        public override void BindProgramParameters(GpuProgramParameters parms, GpuProgramParameters.GpuParamVariability mask)
		{
			if ( parms.HasFloatConstants )
			{
				for ( int index = 0; index < parms.FloatConstantCount; index++ )
				{
					string name = parms.GetNameByIndex( index );

					if ( name != null )
					{
						GpuProgramParameters.FloatConstantEntry entry = parms.GetFloatConstant( index );

						// send the params 4 at a time
						Gl.glProgramNamedParameter4fvNV( programId, name.Length, System.Text.Encoding.ASCII.GetBytes( name ), entry.val ); // TAO 2.0
						//Gl.glProgramNamedParameter4fvNV( programId, name.Length, name, entry.val );
					}
				}
			}
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:23,代码来源:NV3xGpuProgram.cs


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