/*********************************************************************\ |* Shaders *| \*********************************************************************/ protected void updateUniformLocation(Shader shader, Uniform uniform) { int loc = gl.glGetUniformLocation(shader.getId(), uniform.getName()); if (loc < 0) { uniform.setLocation(-1); // uniform is not declared in shader logger.log(Level.FINE, "Uniform {0} is not declared in shader {1}.", new Object[]{uniform.getName(), shader.getSources()}); } else { uniform.setLocation(loc); } }
private void outUniforms(Uniform... uniforms) { if (!evaluated) { evaluateTechniqueDef(); } HashSet<Uniform> actualUniforms = new HashSet<>(); for (Uniform uniform : usedShader.getUniformMap().values()) { if (uniform.getName().startsWith("m_") && !IGNORED_UNIFORMS.contains(uniform.getName())) { actualUniforms.add(uniform); } } HashSet<Uniform> expectedUniforms = new HashSet<>(Arrays.asList(uniforms)); if (!expectedUniforms.equals(actualUniforms)) { Assert.fail("Uniform lists must match: " + expectedUniforms + " != " + actualUniforms); } } }
private void resetUniformsNotSetByCurrent(Shader shader) { ListMap<String, Uniform> uniforms = shader.getUniformMap(); int size = uniforms.size(); for (int i = 0; i < size; i++) { Uniform u = uniforms.getValue(i); if (!u.isSetByCurrentMaterial()) { if (u.getName().charAt(0) != 'g') { // Don't reset world globals! // The benefits gained from this are very minimal // and cause lots of matrix -> FloatBuffer conversions. u.clearValue(); } } } }
protected void updateUniform(Shader shader, Uniform uniform) { int shaderId = shader.getId(); assert uniform.getName() != null; assert shader.getId() > 0;
void notifyClearParam(int paramIndex) { if (shader == null) { return; } String defineName = defineNameArray[paramIndex]; if (defineName != null) { defines.remove(defineName); needReload = true; } if (shader != null) { String paramName = uniformArray[paramIndex].getName(); shader.removeUniform(paramName); uniformArray[paramIndex] = null; } }
/*********************************************************************\ |* Shaders *| \*********************************************************************/ protected void updateUniformLocation(Shader shader, Uniform uniform) { int loc = gl.glGetUniformLocation(shader.getId(), uniform.getName()); if (loc < 0) { uniform.setLocation(-1); // uniform is not declared in shader logger.log(Level.FINE, "Uniform {0} is not declared in shader {1}.", new Object[]{uniform.getName(), shader.getSources()}); } else { uniform.setLocation(loc); } }
/*********************************************************************\ |* Shaders *| \*********************************************************************/ protected void updateUniformLocation(Shader shader, Uniform uniform) { stringBuf.setLength(0); stringBuf.append(uniform.getName()).append('\0'); updateNameBuffer(); int loc = glGetUniformLocation(shader.getId(), nameBuf); if (loc < 0) { uniform.setLocation(-1); // uniform is not declared in shader logger.log(Level.FINE, "Uniform {0} is not declared in shader {1}.", new Object[]{uniform.getName(), shader.getSources()}); } else { uniform.setLocation(loc); } }
/** * Called by the material to tell the technique a parameter was cleared */ void notifyClearParam(String paramName) { String defineName = def.getShaderParamDefine(paramName); if (defineName != null) { defines.remove(defineName); needReload = true; } if (shader != null) { if (!paramName.startsWith("m_")) { paramName = "m_" + paramName; } shader.removeUniform(paramName); for(int i=uniformArray.length-1;i>=0;i--) { if (paramName.equals(uniformArray[i].getName())) { uniformArray[i] = null; } } } } void notifyClearParam(int paramIndex) {
private void resetUniformsNotSetByCurrent(Shader shader) { ListMap<String, Uniform> uniforms = shader.getUniformMap(); int size = uniforms.size(); for (int i = 0; i < size; i++) { Uniform u = uniforms.getValue(i); if (!u.isSetByCurrentMaterial()) { if (u.getName().charAt(0) != 'g') { // Don't reset world globals! // The benefits gained from this are very minimal // and cause lots of matrix -> FloatBuffer conversions. u.clearValue(); } } } }
protected void updateUniform(Shader shader, Uniform uniform) { int shaderId = shader.getId(); assert uniform.getName() != null; assert shader.getId() > 0;
protected void updateUniform(Shader shader, Uniform uniform) { int shaderId = shader.getId(); assert uniform.getName() != null; assert shader.getId() > 0;