(PGraphicsOpenGL g, PImage textureImage)
| 5548 | |
| 5549 | |
| 5550 | protected void rawPolys(PGraphicsOpenGL g, PImage textureImage) { |
| 5551 | PGraphics raw = g.getRaw(); |
| 5552 | |
| 5553 | raw.colorMode(RGB); |
| 5554 | raw.noStroke(); |
| 5555 | raw.beginShape(TRIANGLES); |
| 5556 | |
| 5557 | float[] vertices = tessGeo.polyVertices; |
| 5558 | int[] color = tessGeo.polyColors; |
| 5559 | float[] uv = tessGeo.polyTexCoords; |
| 5560 | short[] indices = tessGeo.polyIndices; |
| 5561 | |
| 5562 | IndexCache cache = tessGeo.polyIndexCache; |
| 5563 | for (int n = firstPolyIndexCache; n <= lastPolyIndexCache; n++) { |
| 5564 | int ioffset = cache.indexOffset[n]; |
| 5565 | int icount = cache.indexCount[n]; |
| 5566 | int voffset = cache.vertexOffset[n]; |
| 5567 | |
| 5568 | for (int tr = ioffset / 3; tr < (ioffset + icount) / 3; tr++) { |
| 5569 | int i0 = voffset + indices[3 * tr + 0]; |
| 5570 | int i1 = voffset + indices[3 * tr + 1]; |
| 5571 | int i2 = voffset + indices[3 * tr + 2]; |
| 5572 | |
| 5573 | float[] src0 = {0, 0, 0, 0}; |
| 5574 | float[] src1 = {0, 0, 0, 0}; |
| 5575 | float[] src2 = {0, 0, 0, 0}; |
| 5576 | float[] pt0 = {0, 0, 0, 0}; |
| 5577 | float[] pt1 = {0, 0, 0, 0}; |
| 5578 | float[] pt2 = {0, 0, 0, 0}; |
| 5579 | int argb0 = PGL.nativeToJavaARGB(color[i0]); |
| 5580 | int argb1 = PGL.nativeToJavaARGB(color[i1]); |
| 5581 | int argb2 = PGL.nativeToJavaARGB(color[i2]); |
| 5582 | |
| 5583 | PApplet.arrayCopy(vertices, 4 * i0, src0, 0, 4); |
| 5584 | PApplet.arrayCopy(vertices, 4 * i1, src1, 0, 4); |
| 5585 | PApplet.arrayCopy(vertices, 4 * i2, src2, 0, 4); |
| 5586 | // Applying any transformation is currently stored in the |
| 5587 | // modelview matrix of the renderer. |
| 5588 | g.modelview.mult(src0, pt0); |
| 5589 | g.modelview.mult(src1, pt1); |
| 5590 | g.modelview.mult(src2, pt2); |
| 5591 | |
| 5592 | if (textureImage != null) { |
| 5593 | raw.texture(textureImage); |
| 5594 | if (raw.is3D()) { |
| 5595 | raw.fill(argb0); |
| 5596 | raw.vertex(pt0[X], pt0[Y], pt0[Z], uv[2 * i0 + 0], uv[2 * i0 + 1]); |
| 5597 | raw.fill(argb1); |
| 5598 | raw.vertex(pt1[X], pt1[Y], pt1[Z], uv[2 * i1 + 0], uv[2 * i1 + 1]); |
| 5599 | raw.fill(argb2); |
| 5600 | raw.vertex(pt2[X], pt2[Y], pt2[Z], uv[2 * i2 + 0], uv[2 * i2 + 1]); |
| 5601 | } else if (raw.is2D()) { |
| 5602 | float sx0 = g.screenXImpl(pt0[0], pt0[1], pt0[2], pt0[3]); |
| 5603 | float sy0 = g.screenYImpl(pt0[0], pt0[1], pt0[2], pt0[3]); |
| 5604 | float sx1 = g.screenXImpl(pt1[0], pt1[1], pt1[2], pt1[3]); |
| 5605 | float sy1 = g.screenYImpl(pt1[0], pt1[1], pt1[2], pt1[3]); |
| 5606 | float sx2 = g.screenXImpl(pt2[0], pt2[1], pt2[2], pt2[3]); |
| 5607 | float sy2 = g.screenYImpl(pt2[0], pt2[1], pt2[2], pt2[3]); |
no test coverage detected