Exemplo n.º 1
0
        private void Uniform2uiv(int location, int count, uint[] value)
        {
            if (location < 0 || value == null || value.Length != 2)
            {
                return;
            }

            ShaderProgram program = this.currentShaderProgram;

            if (program == null)
            {
                SetLastError(ErrorCode.InvalidOperation); return;
            }
            // TODO:GL_INVALID_OPERATION is generated if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command.
            if (count < 0)
            {
                SetLastError(ErrorCode.InvalidValue); return;
            }

            UniformVariable v = program.GetUniformVariable(location);

            if (v == null)
            {
                SetLastError(ErrorCode.InvalidOperation); return;
            }
            FieldInfo fieldInfo = v.fieldInfo;

            if ((count > 1) && (!fieldInfo.FieldType.IsArray))
            {
                SetLastError(ErrorCode.InvalidOperation); return;
            }

            var copy = new uvec2[count];

            for (int i = 0; i < count; i++)
            {
                copy[i] = new uvec2(value[i * 2 + 0], value[i * 2 + 1]);
            }
            program.SetUniform(location, copy);
        }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="xy"></param>
 /// <param name="z"></param>
 public uvec3(uvec2 xy, uint z)
 {
     this.x = xy.x;
     this.y = xy.y;
     this.z = z;
 }
Exemplo n.º 3
0
 public static ivec2 ivec2(uvec2 v)
 {
     return(new ivec2((int)v.x, (int)v.y));
 }
Exemplo n.º 4
0
 public static ivec4 ivec4(uvec2 xy, uint z, uint w)
 {
     return(new ivec4((int)xy.x, (int)xy.y, (int)z, (int)w));
 }
Exemplo n.º 5
0
 public static ivec4 ivec4(uint x, uint y, uvec2 zw)
 {
     return(new ivec4((int)x, (int)y, (int)zw.x, (int)zw.y));
 }
Exemplo n.º 6
0
 public static ivec4 ivec4(uvec2 xy, uvec2 zw)
 {
     return(new ivec4((int)xy.x, (int)xy.y, (int)zw.x, (int)zw.y));
 }
Exemplo n.º 7
0
 public static ivec3 ivec3(uint x, uvec2 yz)
 {
     return(new ivec3((int)x, (int)yz.x, (int)yz.y));
 }
Exemplo n.º 8
0
 public static ivec3 ivec3(uvec2 xy, uint z)
 {
     return(new ivec3((int)xy.x, (int)xy.y, (int)z));
 }