/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new value */ public void setUniform(final String name, final boolean value) { final ShaderVariableInt shaderUniform = getShaderUniform(name, ShaderVariableInt.class); shaderUniform.value1 = value ? 1 : 0; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new value */ public void setUniform(final String name, final float value) { final ShaderVariableFloat shaderUniform = getShaderUniform(name, ShaderVariableFloat.class); shaderUniform.value1 = value; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new value */ public void setUniform(final String name, final IntBuffer value) { final ShaderVariableIntArray shaderUniform = getShaderUniform(name, ShaderVariableIntArray.class); shaderUniform.value = value; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new value */ public void setUniform(final String name, final int value) { final ShaderVariableInt shaderUniform = getShaderUniform(name, ShaderVariableInt.class); shaderUniform.value1 = value; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value1 * the new value * @param value2 * the new value */ public void setUniform(final String name, final int value1, final int value2) { final ShaderVariableInt2 shaderUniform = getShaderUniform(name, ShaderVariableInt2.class); shaderUniform.value1 = value1; shaderUniform.value2 = value2; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new float data * @param size * the number of components per entry (must be 1, 2, 3, or 4) */ public void setUniform(final String name, final FloatBuffer value, final int size) { assert (size >= 1 && size <= 4) : "Size must be 1, 2, 3 or 4"; final ShaderVariableFloatArray shaderUniform = getShaderUniform(name, ShaderVariableFloatArray.class); shaderUniform.value = value; shaderUniform.size = size; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value1 * the new value * @param value2 * the new value */ public void setUniform(final String name, final float value1, final float value2) { final ShaderVariableFloat2 shaderUniform = getShaderUniform(name, ShaderVariableFloat2.class); shaderUniform.value1 = value1; shaderUniform.value2 = value2; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value1 * the new value * @param value2 * the new value */ public void setUniform(final String name, final boolean value1, final boolean value2) { final ShaderVariableInt2 shaderUniform = getShaderUniform(name, ShaderVariableInt2.class); shaderUniform.value1 = value1 ? 1 : 0; shaderUniform.value2 = value2 ? 1 : 0; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value1 * the new value * @param value2 * the new value * @param value3 * the new value */ public void setUniform(final String name, final float value1, final float value2, final float value3) { final ShaderVariableFloat3 shaderUniform = getShaderUniform(name, ShaderVariableFloat3.class); shaderUniform.value1 = value1; shaderUniform.value2 = value2; shaderUniform.value3 = value3; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value1 * the new value * @param value2 * the new value * @param value3 * the new value */ public void setUniform(final String name, final int value1, final int value2, final int value3) { final ShaderVariableInt3 shaderUniform = getShaderUniform(name, ShaderVariableInt3.class); shaderUniform.value1 = value1; shaderUniform.value2 = value2; shaderUniform.value3 = value3; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value1 * the new value * @param value2 * the new value * @param value3 * the new value */ public void setUniform(final String name, final boolean value1, final boolean value2, final boolean value3) { final ShaderVariableInt3 shaderUniform = getShaderUniform(name, ShaderVariableInt3.class); shaderUniform.value1 = value1 ? 1 : 0; shaderUniform.value2 = value2 ? 1 : 0; shaderUniform.value3 = value3 ? 1 : 0; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new value */ public void setUniform(final String name, final int[] value) { final ShaderVariableIntArray shaderUniform = getShaderUniform(name, ShaderVariableIntArray.class); shaderUniform.value = BufferUtils.createIntBuffer(value); setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new value */ public void setUniform(final String name, final float[] value) { final ShaderVariableFloatArray shaderUniform = getShaderUniform(name, ShaderVariableFloatArray.class); shaderUniform.value = BufferUtils.createFloatBuffer(value); setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new value */ public void setUniform(final String name, final ReadOnlyVector2 value) { final ShaderVariableFloat2 shaderUniform = getShaderUniform(name, ShaderVariableFloat2.class); shaderUniform.value1 = (float) value.getX(); shaderUniform.value2 = (float) value.getY(); setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform Matrix4 variable to change * @param value * the new value, assumed row major */ public void setUniformMatrix4(final String name, final FloatBuffer value) { final ShaderVariableMatrix4 shaderUniform = getShaderUniform(name, ShaderVariableMatrix4.class); // prepare buffer for writing shaderUniform.matrixBuffer.rewind(); shaderUniform.matrixBuffer.put(value); // prepare buffer for reading shaderUniform.matrixBuffer.rewind(); value.rewind(); shaderUniform.rowMajor = true; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new value */ public void setUniform(final String name, final ReadOnlyVector3 value) { final ShaderVariableFloat3 shaderUniform = getShaderUniform(name, ShaderVariableFloat3.class); shaderUniform.value1 = (float) value.getX(); shaderUniform.value2 = (float) value.getY(); shaderUniform.value3 = (float) value.getZ(); setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new value * @param rowMajor * true if is this in row major order */ public void setUniform(final String name, final ReadOnlyMatrix4 value, final boolean rowMajor) { final ShaderVariableMatrix4 shaderUniform = getShaderUniform(name, ShaderVariableMatrix4.class); // prepare buffer for writing shaderUniform.matrixBuffer.rewind(); value.toFloatBuffer(shaderUniform.matrixBuffer); // prepare buffer for reading shaderUniform.matrixBuffer.rewind(); shaderUniform.rowMajor = rowMajor; setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new value */ public void setUniform(final String name, final ReadOnlyColorRGBA value) { final ShaderVariableFloat4 shaderUniform = getShaderUniform(name, ShaderVariableFloat4.class); shaderUniform.value1 = value.getRed(); shaderUniform.value2 = value.getGreen(); shaderUniform.value3 = value.getBlue(); shaderUniform.value4 = value.getAlpha(); setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new value */ public void setUniform(final String name, final ReadOnlyVector4 value) { final ShaderVariableFloat4 shaderUniform = getShaderUniform(name, ShaderVariableFloat4.class); shaderUniform.value1 = (float) value.getX(); shaderUniform.value2 = (float) value.getY(); shaderUniform.value3 = (float) value.getZ(); shaderUniform.value4 = (float) value.getW(); setNeedsRefresh(true); }
/** * Set an uniform value for this shader object. * * @param name * uniform variable to change * @param value * the new value */ public void setUniform(final String name, final ReadOnlyQuaternion value) { final ShaderVariableFloat4 shaderUniform = getShaderUniform(name, ShaderVariableFloat4.class); shaderUniform.value1 = (float) value.getX(); shaderUniform.value2 = (float) value.getY(); shaderUniform.value3 = (float) value.getZ(); shaderUniform.value4 = (float) value.getW(); setNeedsRefresh(true); }