Пример #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);
        }
Пример #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;
 }
Пример #3
0
 public static ivec2 ivec2(uvec2 v)
 {
     return(new ivec2((int)v.x, (int)v.y));
 }
Пример #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));
 }
Пример #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));
 }
Пример #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));
 }
Пример #7
0
 public static ivec3 ivec3(uint x, uvec2 yz)
 {
     return(new ivec3((int)x, (int)yz.x, (int)yz.y));
 }
Пример #8
0
 public static ivec3 ivec3(uvec2 xy, uint z)
 {
     return(new ivec3((int)xy.x, (int)xy.y, (int)z));
 }