public FloatBuffer writeTexCoordArray(FloatBuffer store, Vector2f offset, Vector2f scale, float offsetAmount, int totalSize) { if (store != null) { if (store.remaining() < getWidth() * getHeight() * 2) { throw new BufferUnderflowException(); } } else { store = BufferUtils.createFloatBuffer(getWidth() * getHeight() * 2); } if (offset == null) { offset = new Vector2f(); } Vector2f tcStore = new Vector2f(); // work from bottom of heightmap up, so we don't flip the coords for (int y = getHeight() - 1; y >= 0; y--) { for (int x = 0; x < getWidth(); x++) { getUV(x, y, tcStore, offset, offsetAmount, totalSize); float tx = tcStore.x * scale.x; float ty = tcStore.y * scale.y; store.put(tx); store.put(ty); } } return store; }
public FloatBuffer writeTexCoordArray(FloatBuffer store, Vector2f offset, Vector2f scale, float offsetAmount, int totalSize) { if (store != null) { if (store.remaining() < getWidth() * getHeight() * 2) { throw new BufferUnderflowException(); } } else { store = BufferUtils.createFloatBuffer(getWidth() * getHeight() * 2); } if (offset == null) { offset = new Vector2f(); } Vector2f tcStore = new Vector2f(); // work from bottom of heightmap up, so we don't flip the coords for (int y = getHeight() - 1; y >= 0; y--) { for (int x = 0; x < getWidth(); x++) { getUV(x, y, tcStore, offset, offsetAmount, totalSize); float tx = tcStore.x * scale.x; float ty = tcStore.y * scale.y; store.put(tx); store.put(ty); } } return store; }