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 + "\"."); } }
// 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:"); } }