(PGraphicsOpenGL g, PImage textureImage)
| 4971 | |
| 4972 | |
| 4973 | protected void rawPolys(PGraphicsOpenGL g, PImage textureImage) { |
| 4974 | PGraphics raw = g.getRaw(); |
| 4975 | |
| 4976 | raw.colorMode(RGB); |
| 4977 | raw.noStroke(); |
| 4978 | raw.beginShape(TRIANGLES); |
| 4979 | |
| 4980 | float[] vertices = tessGeo.polyVertices; |
| 4981 | int[] color = tessGeo.polyColors; |
| 4982 | float[] uv = tessGeo.polyTexCoords; |
| 4983 | short[] indices = tessGeo.polyIndices; |
| 4984 | |
| 4985 | IndexCache cache = tessGeo.polyIndexCache; |
| 4986 | for (int n = firstPolyIndexCache; n <= lastPolyIndexCache; n++) { |
| 4987 | int ioffset = cache.indexOffset[n]; |
| 4988 | int icount = cache.indexCount[n]; |
| 4989 | int voffset = cache.vertexOffset[n]; |
| 4990 | |
| 4991 | for (int tr = ioffset / 3; tr < (ioffset + icount) / 3; tr++) { |
| 4992 | int i0 = voffset + indices[3 * tr + 0]; |
| 4993 | int i1 = voffset + indices[3 * tr + 1]; |
| 4994 | int i2 = voffset + indices[3 * tr + 2]; |
| 4995 | |
| 4996 | float[] src0 = {0, 0, 0, 0}; |
| 4997 | float[] src1 = {0, 0, 0, 0}; |
| 4998 | float[] src2 = {0, 0, 0, 0}; |
| 4999 | float[] pt0 = {0, 0, 0, 0}; |
| 5000 | float[] pt1 = {0, 0, 0, 0}; |
| 5001 | float[] pt2 = {0, 0, 0, 0}; |
| 5002 | int argb0 = PGL.nativeToJavaARGB(color[i0]); |
| 5003 | int argb1 = PGL.nativeToJavaARGB(color[i1]); |
| 5004 | int argb2 = PGL.nativeToJavaARGB(color[i2]); |
| 5005 | |
| 5006 | PApplet.arrayCopy(vertices, 4 * i0, src0, 0, 4); |
| 5007 | PApplet.arrayCopy(vertices, 4 * i1, src1, 0, 4); |
| 5008 | PApplet.arrayCopy(vertices, 4 * i2, src2, 0, 4); |
| 5009 | // Applying any transformation is currently stored in the |
| 5010 | // modelview matrix of the renderer. |
| 5011 | g.modelview.mult(src0, pt0); |
| 5012 | g.modelview.mult(src1, pt1); |
| 5013 | g.modelview.mult(src2, pt2); |
| 5014 | |
| 5015 | if (textureImage != null) { |
| 5016 | raw.texture(textureImage); |
| 5017 | if (raw.is3D()) { |
| 5018 | raw.fill(argb0); |
| 5019 | raw.vertex(pt0[X], pt0[Y], pt0[Z], uv[2 * i0 + 0], uv[2 * i0 + 1]); |
| 5020 | raw.fill(argb1); |
| 5021 | raw.vertex(pt1[X], pt1[Y], pt1[Z], uv[2 * i1 + 0], uv[2 * i1 + 1]); |
| 5022 | raw.fill(argb2); |
| 5023 | raw.vertex(pt2[X], pt2[Y], pt2[Z], uv[2 * i2 + 0], uv[2 * i2 + 1]); |
| 5024 | } else if (raw.is2D()) { |
| 5025 | float sx0 = g.screenXImpl(pt0[0], pt0[1], pt0[2], pt0[3]); |
| 5026 | float sy0 = g.screenYImpl(pt0[0], pt0[1], pt0[2], pt0[3]); |
| 5027 | float sx1 = g.screenXImpl(pt1[0], pt1[1], pt1[2], pt1[3]); |
| 5028 | float sy1 = g.screenYImpl(pt1[0], pt1[1], pt1[2], pt1[3]); |
| 5029 | float sx2 = g.screenXImpl(pt2[0], pt2[1], pt2[2], pt2[3]); |
| 5030 | float sy2 = g.screenYImpl(pt2[0], pt2[1], pt2[2], pt2[3]); |
no test coverage detected