(PGraphicsOpenGL g)
| 5667 | |
| 5668 | |
| 5669 | protected void rawLines(PGraphicsOpenGL g) { |
| 5670 | PGraphics raw = g.getRaw(); |
| 5671 | |
| 5672 | raw.colorMode(RGB); |
| 5673 | raw.noFill(); |
| 5674 | raw.strokeCap(strokeCap); |
| 5675 | raw.strokeJoin(strokeJoin); |
| 5676 | raw.beginShape(LINES); |
| 5677 | |
| 5678 | float[] vertices = tessGeo.lineVertices; |
| 5679 | int[] color = tessGeo.lineColors; |
| 5680 | float[] attribs = tessGeo.lineDirections; |
| 5681 | short[] indices = tessGeo.lineIndices; |
| 5682 | |
| 5683 | IndexCache cache = tessGeo.lineIndexCache; |
| 5684 | for (int n = firstLineIndexCache; n <= lastLineIndexCache; n++) { |
| 5685 | int ioffset = cache.indexOffset[n]; |
| 5686 | int icount = cache.indexCount[n]; |
| 5687 | int voffset = cache.vertexOffset[n]; |
| 5688 | |
| 5689 | for (int ln = ioffset / 6; ln < (ioffset + icount) / 6; ln++) { |
| 5690 | // Each line segment is defined by six indices since it's |
| 5691 | // formed by two triangles. We only need the first and last |
| 5692 | // vertices. |
| 5693 | // This bunch of vertices could also be the bevel triangles, |
| 5694 | // with we detect this situation by looking at the line weight. |
| 5695 | int i0 = voffset + indices[6 * ln + 0]; |
| 5696 | int i1 = voffset + indices[6 * ln + 5]; |
| 5697 | float sw0 = 2 * attribs[4 * i0 + 3]; |
| 5698 | float sw1 = 2 * attribs[4 * i1 + 3]; |
| 5699 | |
| 5700 | if (PGraphicsOpenGL.zero(sw0)) continue; // Bevel triangles, skip. |
| 5701 | |
| 5702 | float[] src0 = {0, 0, 0, 0}; |
| 5703 | float[] src1 = {0, 0, 0, 0}; |
| 5704 | float[] pt0 = {0, 0, 0, 0}; |
| 5705 | float[] pt1 = {0, 0, 0, 0}; |
| 5706 | int argb0 = PGL.nativeToJavaARGB(color[i0]); |
| 5707 | int argb1 = PGL.nativeToJavaARGB(color[i1]); |
| 5708 | |
| 5709 | PApplet.arrayCopy(vertices, 4 * i0, src0, 0, 4); |
| 5710 | PApplet.arrayCopy(vertices, 4 * i1, src1, 0, 4); |
| 5711 | // Applying any transformation is currently stored in the |
| 5712 | // modelview matrix of the renderer. |
| 5713 | g.modelview.mult(src0, pt0); |
| 5714 | g.modelview.mult(src1, pt1); |
| 5715 | |
| 5716 | if (raw.is3D()) { |
| 5717 | raw.strokeWeight(sw0); |
| 5718 | raw.stroke(argb0); |
| 5719 | raw.vertex(pt0[X], pt0[Y], pt0[Z]); |
| 5720 | raw.strokeWeight(sw1); |
| 5721 | raw.stroke(argb1); |
| 5722 | raw.vertex(pt1[X], pt1[Y], pt1[Z]); |
| 5723 | } else if (raw.is2D()) { |
| 5724 | float sx0 = g.screenXImpl(pt0[0], pt0[1], pt0[2], pt0[3]); |
| 5725 | float sy0 = g.screenYImpl(pt0[0], pt0[1], pt0[2], pt0[3]); |
| 5726 | float sx1 = g.screenXImpl(pt1[0], pt1[1], pt1[2], pt1[3]); |
no test coverage detected