MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / line

Method line

src/main/java/field/graphics/MeshBuilder.java:595–632  ·  view source on GitHub ↗

Adds a string of line segments stretching from start all the way through to end. vertex numbers are backwards from the current vertex, so vertex 0 is the most recent call to v, 1 is the vertex before that and so on

(int start, int end)

Source from the content-addressed store, hash-verified

593 IntBuffer dest = ensureElementSize(2, elementCursor + Math.abs(start - end));
594 if (start < 0)
595 throw new IllegalArgumentException(
596 " can't write line into vertexbuffer, trying to access an unwritten index with start " + start);
597 if (end < 0)
598 throw new IllegalArgumentException(
599 " can't write line into vertexbuffer, trying to access an unwritten index with end " + start);
600 if (end > start) {
601 if (vertexCursor - 1 - (start + 1) < 0)
602 throw new IllegalArgumentException(
603 " can't write line into vertexbuffer, trying to access a negative index with start " + start + " > " + (vertexCursor - 1));
604 if (vertexCursor - 1 - (end - 1 + 1) < 0)
605 throw new IllegalArgumentException(
606 " can't write line into vertexbuffer, trying to access a negative index with end " + end + " > " + (vertexCursor - 1));
607
608 for (int a = start; a < end; a++) {
609 dest.put(vertexCursor - 1 - a);
610 dest.put(vertexCursor - 1 - (a + 1));
611 elementCursor++;
612 }
613 } else {
614 if (vertexCursor - 1 - (start - 1) < 0)
615 throw new IllegalArgumentException(
616 " can't write line into vertexbuffer, trying to access a negative index with start " + start + " > " + (vertexCursor - 1));
617 if (vertexCursor - 1 - (end + 1 - 1) < 0)
618 throw new IllegalArgumentException(
619 " can't write line into vertexbuffer, trying to access a negative index with end " + end + " > " + (vertexCursor - 1));
620
621 for (int a = start - 1; a > end; a--) {
622 dest.put(vertexCursor - 1 - a);
623 dest.put(vertexCursor - 1 - (a - 1));
624 elementCursor++;
625 }
626 }
627
628 return this;
629 }
630
631 /**
632 * Adds a string of line segments stretching from start all the way through to end.
633 * <p>
634 * vertex numbers are backwards from the current vertex, so vertex 0 is the most recent call to v, 1 is the vertex before that and so on
635 */

Callers 1

renderToLineMethod · 0.45

Calls 5

ensureElementSizeMethod · 0.95
vMethod · 0.95
getMethod · 0.65
putMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected