Axiom.Graphics.GpuProgramParameters.FindNamedConstantDefinition C# (CSharp) Method

FindNamedConstantDefinition() public method

Find a constant definition for a named parameter. This method returns null if the named parameter did not exist, unlike GetConstantDefinition which is more strict; unless you set the last parameter to true.
public FindNamedConstantDefinition ( string name, bool throwExceptionIfNotFound ) : GpuConstantDefinition
name string The name to look up
throwExceptionIfNotFound bool
return GpuConstantDefinition
        public GpuConstantDefinition FindNamedConstantDefinition(string name, bool throwExceptionIfNotFound)
	    {

            if (namedParams == null)
		    {
                if (throwExceptionIfNotFound)
                    throw new AxiomException( "Named constants have not been initialised, perhaps a compile error." );
			    return null;
		    }

            int value;
            if (!namedParams.TryGetValue( name, out value ))
		    {
			    if (throwExceptionIfNotFound)
			        throw new AxiomException( "Parameter called " + name + " does not exist. " );
			    return null;
		    }
		    //else
	        {
                // temp hack (gotta update this mess)
	            var def = new GpuConstantDefinition();
	            def.LogicalIndex = value;
	            def.PhysicalIndex = value;
	            return def;
	            //return &(i->second);
	        }
	    }
	}

Usage Example

Example #1
0
		public void Bind( GpuProgramParameters gpuParams )
		{
			if ( gpuParams != null )
			{
				Axiom.Graphics.GpuProgramParameters.GpuConstantDefinition def =
					gpuParams.FindNamedConstantDefinition( _name );

				if ( def != null )
				{
					this._params = gpuParams;
					this.physicalIndex = def.PhysicalIndex;
				}
			}
		}
All Usage Examples Of Axiom.Graphics.GpuProgramParameters::FindNamedConstantDefinition