예제 #1
0
파일: uvec4.cs 프로젝트: xinfushe/SoftGL
 /// <summary>
 ///
 /// </summary>
 /// <param name="xyz"></param>
 /// <param name="w"></param>
 public uvec4(uvec3 xyz, uint w)
 {
     this.x = xyz.x;
     this.y = xyz.y;
     this.z = xyz.z;
     this.w = w;
 }
예제 #2
0
        private void Uniform3uiv(int location, int count, uint[] value)
        {
            if (location < 0 || value == null || value.Length != 3)
            {
                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 uvec3[count];

            for (int i = 0; i < count; i++)
            {
                copy[i] = new uvec3(value[i * 3 + 0], value[i * 3 + 1], value[i * 3 + 2]);
            }
            program.SetUniform(location, copy);
        }
예제 #3
0
파일: uvec2.cs 프로젝트: xinfushe/SoftGL
 /// <summary>
 ///
 /// </summary>
 /// <param name="v"></param>
 public uvec2(uvec3 v)
 {
     this.x = v.x;
     this.y = v.y;
 }
예제 #4
0
 public static ivec4 ivec4(uint x, uvec3 yzw)
 {
     return(new ivec4((int)x, (int)yzw.x, (int)yzw.y, (int)yzw.z));
 }
예제 #5
0
 public static ivec4 ivec4(uvec3 xyz, uint w)
 {
     return(new ivec4((int)xyz.x, (int)xyz.y, (int)xyz.z, (int)w));
 }
예제 #6
0
 public static ivec2 ivec2(uvec3 v)
 {
     return(new ivec2((int)v.x, (int)v.y));
 }