(PGraphicsOpenGL g)
| 5090 | |
| 5091 | |
| 5092 | protected void rawLines(PGraphicsOpenGL g) { |
| 5093 | PGraphics raw = g.getRaw(); |
| 5094 | |
| 5095 | raw.colorMode(RGB); |
| 5096 | raw.noFill(); |
| 5097 | raw.strokeCap(strokeCap); |
| 5098 | raw.strokeJoin(strokeJoin); |
| 5099 | raw.beginShape(LINES); |
| 5100 | |
| 5101 | float[] vertices = tessGeo.lineVertices; |
| 5102 | int[] color = tessGeo.lineColors; |
| 5103 | float[] attribs = tessGeo.lineDirections; |
| 5104 | short[] indices = tessGeo.lineIndices; |
| 5105 | |
| 5106 | IndexCache cache = tessGeo.lineIndexCache; |
| 5107 | for (int n = firstLineIndexCache; n <= lastLineIndexCache; n++) { |
| 5108 | int ioffset = cache.indexOffset[n]; |
| 5109 | int icount = cache.indexCount[n]; |
| 5110 | int voffset = cache.vertexOffset[n]; |
| 5111 | |
| 5112 | for (int ln = ioffset / 6; ln < (ioffset + icount) / 6; ln++) { |
| 5113 | // Each line segment is defined by six indices since its |
| 5114 | // formed by two triangles. We only need the first and last |
| 5115 | // vertices. |
| 5116 | // This bunch of vertices could also be the bevel triangles, |
| 5117 | // with we detect this situation by looking at the line weight. |
| 5118 | int i0 = voffset + indices[6 * ln + 0]; |
| 5119 | int i1 = voffset + indices[6 * ln + 5]; |
| 5120 | float sw0 = 2 * attribs[4 * i0 + 3]; |
| 5121 | float sw1 = 2 * attribs[4 * i1 + 3]; |
| 5122 | |
| 5123 | if (PGraphicsOpenGL.zero(sw0)) continue; // Bevel triangles, skip. |
| 5124 | |
| 5125 | float[] src0 = {0, 0, 0, 0}; |
| 5126 | float[] src1 = {0, 0, 0, 0}; |
| 5127 | float[] pt0 = {0, 0, 0, 0}; |
| 5128 | float[] pt1 = {0, 0, 0, 0}; |
| 5129 | int argb0 = PGL.nativeToJavaARGB(color[i0]); |
| 5130 | int argb1 = PGL.nativeToJavaARGB(color[i1]); |
| 5131 | |
| 5132 | PApplet.arrayCopy(vertices, 4 * i0, src0, 0, 4); |
| 5133 | PApplet.arrayCopy(vertices, 4 * i1, src1, 0, 4); |
| 5134 | // Applying any transformation is currently stored in the |
| 5135 | // modelview matrix of the renderer. |
| 5136 | g.modelview.mult(src0, pt0); |
| 5137 | g.modelview.mult(src1, pt1); |
| 5138 | |
| 5139 | if (raw.is3D()) { |
| 5140 | raw.strokeWeight(sw0); |
| 5141 | raw.stroke(argb0); |
| 5142 | raw.vertex(pt0[X], pt0[Y], pt0[Z]); |
| 5143 | raw.strokeWeight(sw1); |
| 5144 | raw.stroke(argb1); |
| 5145 | raw.vertex(pt1[X], pt1[Y], pt1[Z]); |
| 5146 | } else if (raw.is2D()) { |
| 5147 | float sx0 = g.screenXImpl(pt0[0], pt0[1], pt0[2], pt0[3]); |
| 5148 | float sy0 = g.screenYImpl(pt0[0], pt0[1], pt0[2], pt0[3]); |
| 5149 | float sx1 = g.screenXImpl(pt1[0], pt1[1], pt1[2], pt1[3]); |
no test coverage detected