/// <summary> /// The virtual setMethod of the property <see cref="Position"/> /// </summary> protected virtual void setPosition(xyzwf value) { FPosition = value; if ((Device == null) || (Device.Shader == null)) { return; } int id = Device.Lights.IndexOf(this); if ((Device == null) || (Device.Shader == null)) { return; } Field F = Device.Shader.getvar("Lights[" + id.ToString() + "].position"); if (F != null) { F.Update(); } else { if (id == 0) { F = Device.Shader.getvar("Light0Position"); if (F != null) { F.Update(); } } } }
/// <summary> /// sets the <see cref="xyzwf"/> value to the field. It works only when the shader is <see cref="OGLShader.Using"/> true is. /// </summary> /// <param name="value">is <see cref="xyzwf"/> value</param> /// <returns>true when the shader is using and the field has a handle >=0.</returns> public bool SetValue(xyzwf value) { if (!(Owner.Using) || (handle < 0)) { return(false); } float[] C = new float[] { value.x, value.y, value.z, value.w }; float[] N = new float[2]; GL.Uniform4(handle, C[0], C[1], C[2], C[3]); GL.GetUniform(Owner.Handle, handle, N); return(true); }