public IUniformValue GetUninitialized() { Ints clone = new Ints(Elements, Dimension); for (int i = 0; i < Value.Length; ++i) { clone.Value[i] = int.MaxValue; } return(clone); }
public unsafe void Ints(int offset, Ints param) { fixed(byte *bptr = &data[offset]) { int *ptr = (int *)bptr; for (int i = 0; i < param.Value.Length; ++i) { ptr[i] = param.Value[i]; } } needsUpload = true; }
public MultiInts(string name, Ints @default, params IUniformBuffer[] buffers) { if (buffers.Length > 0) { this.array = new Ints[buffers.Length]; for (int i = 0; i < buffers.Length; ++i) { array[i] = (buffers[i] != null) && (buffers[i].Contains(name)) ? buffers[i].Ints(name) : @default; } } else { this.array = new Ints[1]; array[0] = @default; } first = array[0]; }
public UniformBufferData(IUniformBlock uniformBlock /*, IBufferRange bufferRange*/) { this.uniformBlock = uniformBlock; //this.uniformBufferRange = bufferRange; parameterArray = new IUniformValue[uniformBlock.Uniforms.Count]; int i = 0; foreach (var uniform in uniformBlock.Uniforms) { #if DEBUG_UNIFORM_BUFFER System.Diagnostics.Debug.WriteLine( uniform.Type.ToString() + " " + uniform.Name + ", index = " + uniform.Index + ", i = " + i + ", offset = " + uniform.Offset + ", stride = " + uniform.Stride ); #endif switch (uniform.Type) { case ActiveUniformType.Float: parameterArray[i] = new Floats(1, uniform.Count); break; case ActiveUniformType.FloatVec2: parameterArray[i] = new Floats(2, uniform.Count); break; case ActiveUniformType.FloatVec3: parameterArray[i] = new Floats(3, uniform.Count); break; case ActiveUniformType.FloatVec4: parameterArray[i] = new Floats(4, uniform.Count); break; case ActiveUniformType.FloatMat4: parameterArray[i] = new Floats(16, uniform.Count); break; case ActiveUniformType.Int: parameterArray[i] = new Ints(1, uniform.Count); break; case ActiveUniformType.UnsignedInt: parameterArray[i] = new UInts(1, uniform.Count); break; case ActiveUniformType.Sampler1D: break; case ActiveUniformType.Sampler1DArray: break; case ActiveUniformType.Sampler1DArrayShadow: break; case ActiveUniformType.Sampler1DShadow: break; case ActiveUniformType.Sampler2D: break; case ActiveUniformType.Sampler2DArray: break; case ActiveUniformType.Sampler2DArrayShadow: break; case ActiveUniformType.Sampler2DMultisample: break; case ActiveUniformType.Sampler2DMultisampleArray: break; case ActiveUniformType.Sampler2DRect: break; case ActiveUniformType.Sampler2DRectShadow: break; case ActiveUniformType.Sampler2DShadow: break; case ActiveUniformType.Sampler3D: break; case ActiveUniformType.SamplerBuffer: break; case ActiveUniformType.SamplerCube: break; case ActiveUniformType.SamplerCubeMapArray: break; case ActiveUniformType.SamplerCubeMapArrayShadow: break; case ActiveUniformType.SamplerCubeShadow: break; default: { throw new System.Exception("Unsupported uniform type"); } } if (parameterArray[i] != null) { parameterArray[i].Index = i;//uniform.Index; parameters[uniform.Name] = parameterArray[i]; if (uniform.Default != null) { parameterArray[i].CopyFrom(uniform.Default); } } i++; } }
public void Ints(int offset, Ints param) { bufferRangeGL.Ints(offset, param); bufferRangeRL.Ints(offset, param); }