private void checkIsFloatingPoint(final JCGLProgramUniformType u) { if (this.check_type) { final JCGLType type_uniform = u.type(); if (!type_uniform.isFloatingPointType()) { final StringBuilder sb = new StringBuilder(128); sb.append("Uniform type error."); sb.append(System.lineSeparator()); sb.append("Expected: A floating point type"); sb.append(System.lineSeparator()); sb.append("Actual: "); sb.append(type_uniform); throw new JCGLExceptionProgramTypeError(sb.toString()); } } }
private static Map<String, JCGLType> getNames() { final JCGLType[] vs = JCGLType.values(); final Map<String, JCGLType> m = new HashMap<>(vs.length); for (final JCGLType t : vs) { m.put(t.name, t); } return m; }
@Override public void shaderUniformPutVectorf( final JCGLProgramUniformType u, final FloatBuffer value) throws JCGLException, JCGLExceptionProgramNotActive, JCGLExceptionProgramTypeError { this.checkActive(u); this.checkIsFloatingPoint(u); final int available = value.capacity() / 4; final JCGLType type = u.type(); final int required = type.getElementCount(); if (available < required) { final StringBuilder sb = new StringBuilder(128); sb.append("Uniform data error."); sb.append(System.lineSeparator()); sb.append("Expected: A buffer containing at least "); sb.append(required); sb.append(" floating point values"); sb.append(System.lineSeparator()); sb.append("Actual: A buffer containing "); sb.append(available); sb.append(" floating point values"); throw new JCGLExceptionProgramTypeError(sb.toString()); } }
private void checkType( final JCGLProgramUniformType u, final JCGLType t) { if (this.check_type) { if (!u.getType().equals(t)) { throw FakeShaders.errorWrongType(u, t); } } }
@Override public void shaderUniformPutVectorf( final JCGLProgramUniformType u, final FloatBuffer value) throws JCGLException, JCGLExceptionProgramNotActive, JCGLExceptionProgramTypeError { this.checkActive(u); this.checkIsFloatingPoint(u); final int available = value.capacity() / 4; final JCGLType type = u.getType(); final int required = type.getElementCount(); if (available < required) { final StringBuilder sb = new StringBuilder(128); sb.append("Uniform data error."); sb.append(System.lineSeparator()); sb.append("Expected: A buffer containing at least "); sb.append(required); sb.append(" floating point values"); sb.append(System.lineSeparator()); sb.append("Actual: A buffer containing "); sb.append(available); sb.append(" floating point values"); throw new JCGLExceptionProgramTypeError(sb.toString()); } }
private void checkType( final JCGLProgramUniformType u, final JCGLType type_given) { if (this.check_type) { final JCGLType type_uniform = u.getType(); if (!type_uniform.equals(type_given)) { throw LWJGL3Shaders.errorWrongType(u, type_given); } } }
private void checkIsFloatingPoint(final JCGLProgramUniformType u) { if (this.check_type) { final JCGLType type_uniform = u.getType(); if (!type_uniform.isFloatingPointType()) { final StringBuilder sb = new StringBuilder(128); sb.append("Uniform type error."); sb.append(System.lineSeparator()); sb.append("Expected: A floating point type"); sb.append(System.lineSeparator()); sb.append("Actual: "); sb.append(type_uniform); throw new JCGLExceptionProgramTypeError(sb.toString()); } } }
final int required = type.getElementCount(); if (available < required) { final StringBuilder sb = new StringBuilder(128);
private static Map<String, JCGLType> getNames() { final JCGLType[] vs = JCGLType.values(); final Map<String, JCGLType> m = new HashMap<>(vs.length); for (final JCGLType t : vs) { m.put(t.name, t); } return m; }
private void checkIsFloatingPoint(final JCGLProgramUniformType u) { if (this.check_type) { final JCGLType type_uniform = u.getType(); if (!type_uniform.isFloatingPointType()) { final StringBuilder sb = new StringBuilder(128); sb.append("Uniform type error."); sb.append(System.lineSeparator()); sb.append("Expected: A floating point type"); sb.append(System.lineSeparator()); sb.append("Actual: "); sb.append(type_uniform); throw new JCGLExceptionProgramTypeError(sb.toString()); } } }
final int required = type.getElementCount(); if (available < required) { final StringBuilder sb = new StringBuilder(128);
private void checkIsFloatingPoint(final JCGLProgramUniformType u) { if (this.check_type) { final JCGLType type_uniform = u.type(); if (!type_uniform.isFloatingPointType()) { final StringBuilder sb = new StringBuilder(128); sb.append("Uniform type error."); sb.append(System.lineSeparator()); sb.append("Expected: A floating point type"); sb.append(System.lineSeparator()); sb.append("Actual: "); sb.append(type_uniform); throw new JCGLExceptionProgramTypeError(sb.toString()); } } }