@Test public void testAppendValueToUniform() { final PipelineInfo pipelineInfo = new PipelineInfo(); pipelineInfo.addUniform("a", BasicType.FLOAT, Optional.empty(), Collections.singletonList(1.0)); assertTrue(pipelineInfo.hasUniform("a")); final List<String> args = pipelineInfo.getArgs("a"); assertEquals(args, Collections.singletonList("1.0")); final String pipelineBefore = "{\n" + " \"a\": {\n" + " \"func\": \"glUniform1f\",\n" + " \"args\": [\n" + " 1.0\n" + " ]\n" + " }\n" + "}"; assertEquals(pipelineInfo.toString(), pipelineBefore); final int index = pipelineInfo.appendValueToUniform("a", 2.0); assertEquals(index, 1); final List<String> args2 = pipelineInfo.getArgs("a"); assertEquals(args2, Arrays.asList("1.0", "2.0")); final String pipelineAfter = "{\n" + " \"a\": {\n" + " \"func\": \"glUniform1f\",\n" + " \"args\": [\n" + " 1.0,\n" + " 2.0\n" + " ]\n" + " }\n" + "}"; assertEquals(pipelineInfo.toString(), pipelineAfter); }
public int appendValueToUniform(String uniformName, Number value) { if (!dictionary.has(uniformName)) { throw new IllegalArgumentException("Uniform declaration not found."); } dictionary.getAsJsonObject(uniformName).get("args").getAsJsonArray().add(value); return dictionary.getAsJsonObject(uniformName).get("args").getAsJsonArray().size() - 1; }
PipelineInfo { public int appendValueToUniform(String uniformName, Number value) { if (!dictionary.has(uniformName)) { throw new IllegalArgumentException("Uniform declaration not found."); } dictionary.getAsJsonObject(uniformName).get("args").getAsJsonArray().add(value); return dictionary.getAsJsonObject(uniformName).get("args").getAsJsonArray().size() - 1; } }
PipelineInfo { public int appendValueToUniform(String uniformName, Number value) { if (!dictionary.has(uniformName)) { throw new IllegalArgumentException("Uniform declaration not found."); } dictionary.getAsJsonObject(uniformName).get("args").getAsJsonArray().add(value); return dictionary.getAsJsonObject(uniformName).get("args").getAsJsonArray().size() - 1; } private  PipelineInfo(JsonObject dictionary);  PipelineInfo();  PipelineInfo(File file);  PipelineInfo(String string); }
PipelineInfo { public int appendValueToUniform(String uniformName, Number value) { if (!dictionary.has(uniformName)) { throw new IllegalArgumentException("Uniform declaration not found."); } dictionary.getAsJsonObject(uniformName).get("args").getAsJsonArray().add(value); return dictionary.getAsJsonObject(uniformName).get("args").getAsJsonArray().size() - 1; } private  PipelineInfo(JsonObject dictionary);  PipelineInfo();  PipelineInfo(File file);  PipelineInfo(String string); void addUniform(String name, BasicType basicType,
                         Optional<Integer> arrayCount, List<? extends Number> values); void addUniform(String name, SamplerType samplerType, BuiltInTexture value); boolean hasUniform(String uniformName); @Override String toString(); void setUniforms(TranslationUnit tu,
      Supplier<Float> floatSupplier, Supplier<Integer> intSupplier,
      Supplier<Integer> uintSupplier,
      Supplier<Integer> boolSupplier,
      Supplier<BuiltInTexture> textureSupplier); void zeroUnsetUniforms(TranslationUnit tu); void addUniformBinding(String uniformName, boolean pushConstant, int number); void removeUniformBinding(String uniformName); int appendValueToUniform(String uniformName, Number value); List<String> getUniformNames(); int getNumUniforms(); void removeUniform(String uniformName); PipelineInfo renameUniforms(Map<String, String> uniformMapping); List<String> getArgs(String uniformName); boolean hasBindingOrIsPushConstant(String uniformName); boolean hasBinding(String uniformName); boolean isPushConstant(String uniformName); boolean isSampler(String uniformName); int getBinding(String uniformName); void addComputeInfo(int numGroupsX, int numGroupsY, int numGroupsZ,
                             int ssboBinding,
                             List<SsboFieldData> ssboFields); boolean hasGridInfo(); int getGridColumns(); int getGridRows(); void addGridInfo(int columns, int rows); int getUnusedBindingNumber(); void addSamplerInfo(String name, String samplerType, String textureName); @Override PipelineInfo clone(); }
PipelineInfo { public int appendValueToUniform(String uniformName, Number value) { if (!dictionary.has(uniformName)) { throw new IllegalArgumentException("Uniform declaration not found."); } dictionary.getAsJsonObject(uniformName).get("args").getAsJsonArray().add(value); return dictionary.getAsJsonObject(uniformName).get("args").getAsJsonArray().size() - 1; } private  PipelineInfo(JsonObject dictionary);  PipelineInfo();  PipelineInfo(File file);  PipelineInfo(String string); void addUniform(String name, BasicType basicType,
                         Optional<Integer> arrayCount, List<? extends Number> values); void addUniform(String name, SamplerType samplerType, BuiltInTexture value); boolean hasUniform(String uniformName); @Override String toString(); void setUniforms(TranslationUnit tu,
      Supplier<Float> floatSupplier, Supplier<Integer> intSupplier,
      Supplier<Integer> uintSupplier,
      Supplier<Integer> boolSupplier,
      Supplier<BuiltInTexture> textureSupplier); void zeroUnsetUniforms(TranslationUnit tu); void addUniformBinding(String uniformName, boolean pushConstant, int number); void removeUniformBinding(String uniformName); int appendValueToUniform(String uniformName, Number value); List<String> getUniformNames(); int getNumUniforms(); void removeUniform(String uniformName); PipelineInfo renameUniforms(Map<String, String> uniformMapping); List<String> getArgs(String uniformName); boolean hasBindingOrIsPushConstant(String uniformName); boolean hasBinding(String uniformName); boolean isPushConstant(String uniformName); boolean isSampler(String uniformName); int getBinding(String uniformName); void addComputeInfo(int numGroupsX, int numGroupsY, int numGroupsZ,
                             int ssboBinding,
                             List<SsboFieldData> ssboFields); boolean hasGridInfo(); int getGridColumns(); int getGridRows(); void addGridInfo(int columns, int rows); int getUnusedBindingNumber(); void addSamplerInfo(String name, String samplerType, String textureName); @Override PipelineInfo clone();  }