Esempio n. 1
0
        public override bool TrySetMember(SetMemberBinder binder, object value)
        {
            // cache location

            var isvec2 = value is __vec2;

            if (isvec2)
            {
                var value_vec2 = (__vec2)value;
                gl.uniform2f(
                    gl.getUniformLocation(program, binder.Name),
                    value_vec2
                    );
                return(true);
            }

            gl.uniform1f(gl.getUniformLocation(program, binder.Name), (float)value);
            return(true);
        }
        public override bool TrySetMember(SetMemberBinder binder, object value)
        {
            // cache location

            // this class if for floats. ints will need their own class

            var isvec2 = value is __vec2;

            if (isvec2)
            {
                var value_vec2 = (__vec2)value;

                gl.uniform2f(
                    gl.getUniformLocation(program, binder.Name),
                    value_vec2
                    );

                return(true);
            }

            var isvec3 = value is __vec3;

            if (isvec3)
            {
                var value_vec3 = (__vec3)value;

                gl.uniform3f(
                    gl.getUniformLocation(program, binder.Name),
                    value_vec3
                    );

                return(true);
            }

            gl.uniform1f(gl.getUniformLocation(program, binder.Name), (float)value);
            return(true);
        }
Esempio n. 3
0
 public static void uniform2f(this gl gl, WebGLUniformLocation location, __vec2 xy)
 {
     gl.uniform2f(location, xy.x, xy.y);
 }