コード例 #1
0
ファイル: Shader.cs プロジェクト: Sean889/PlanetDevTest
        public void SetParameter <T>(string name, T value)
        {
            try
            {
                switch (name)
                {
                case "LightDir":
                    uniform_LightDir = (global::OpenTK.Vector3)(object) value;
                    break;

                case "MVP":
                    uniform_MVP = (global::OpenTK.Matrix4)(object) value;
                    break;

                case "MaxDisplacement":
                    uniform_MaxDisplacement = (float)(object)value;
                    break;

                default:
                    throw new global::ShaderRuntime.InvalidIdentifierException("There is no uniform variable named " + name + " in this shader.");
                }
            }
            catch (InvalidCastException e)
            {
                throw new global::ShaderRuntime.InvalidParameterTypeException("Invalid parameter type: " + name + " is not convertible from the type \"" + typeof(T).FullName + "\".");
            }
        }
コード例 #2
0
ファイル: SKUniform.cs プロジェクト: zippo227/xamarin-macios
 // Apple deprecated initWithName:floatMatrix4: in macOS10.12/iOS10.0
 // and made available initWithName:matrixFloat4x4: so we invoke
 // the right one at runtime depending on which OS version we are running
 public SKUniform(string name, Matrix4 value)
 {
     if (CheckSystemVersion())
     {
         InitializeHandle(InitWithNameMatrixFloat4x4(name, value), "initWithName:matrixFloat4x4:");
     }
     else
     {
         InitializeHandle(InitWithNameFloatMatrix4(name, value), "initWithName:floatMatrix4:");
     }
 }