MCPcopy Index your code
hub / github.com/benfry/processing4 / rawPoints

Method rawPoints

core/src/processing/opengl/PShapeOpenGL.java:5766–5826  ·  view source on GitHub ↗
(PGraphicsOpenGL g)

Source from the content-addressed store, hash-verified

5764
5765
5766 protected void rawPoints(PGraphicsOpenGL g) {
5767 PGraphics raw = g.getRaw();
5768
5769 raw.colorMode(RGB);
5770 raw.noFill();
5771 raw.strokeCap(strokeCap);
5772 raw.beginShape(POINTS);
5773
5774 float[] vertices = tessGeo.pointVertices;
5775 int[] color = tessGeo.pointColors;
5776 float[] attribs = tessGeo.pointOffsets;
5777 short[] indices = tessGeo.pointIndices;
5778
5779 IndexCache cache = tessGeo.pointIndexCache;
5780 for (int n = 0; n < cache.size; n++) {
5781 int ioffset = cache.indexOffset[n];
5782 int icount = cache.indexCount[n];
5783 int voffset = cache.vertexOffset[n];
5784
5785 int pt = ioffset;
5786 while (pt < (ioffset + icount) / 3) {
5787 float size = attribs[2 * pt + 2];
5788 float weight;
5789 int perim;
5790 if (0 < size) { // round point
5791 weight = +size / 0.5f;
5792 perim = PApplet.min(PGraphicsOpenGL.MAX_POINT_ACCURACY,
5793 PApplet.max(PGraphicsOpenGL.MIN_POINT_ACCURACY,
5794 (int) (TWO_PI * weight /
5795 PGraphicsOpenGL.POINT_ACCURACY_FACTOR))) + 1;
5796 } else { // Square point
5797 weight = -size / 0.5f;
5798 perim = 5;
5799 }
5800
5801 int i0 = voffset + indices[3 * pt];
5802 int argb0 = PGL.nativeToJavaARGB(color[i0]);
5803 float[] pt0 = {0, 0, 0, 0};
5804
5805 float[] src0 = {0, 0, 0, 0};
5806 PApplet.arrayCopy(vertices, 4 * i0, src0, 0, 4);
5807 g.modelview.mult(src0, pt0);
5808
5809 if (raw.is3D()) {
5810 raw.strokeWeight(weight);
5811 raw.stroke(argb0);
5812 raw.vertex(pt0[X], pt0[Y], pt0[Z]);
5813 } else if (raw.is2D()) {
5814 float sx0 = g.screenXImpl(pt0[0], pt0[1], pt0[2], pt0[3]);
5815 float sy0 = g.screenYImpl(pt0[0], pt0[1], pt0[2], pt0[3]);
5816 raw.strokeWeight(weight);
5817 raw.stroke(argb0);
5818 raw.vertex(sx0, sy0);
5819 }
5820
5821 pt += perim;
5822 }
5823 }

Callers 1

renderMethod · 0.95

Calls 15

colorModeMethod · 0.95
noFillMethod · 0.95
strokeCapMethod · 0.95
beginShapeMethod · 0.95
minMethod · 0.95
maxMethod · 0.95
nativeToJavaARGBMethod · 0.95
arrayCopyMethod · 0.95
is3DMethod · 0.95
strokeWeightMethod · 0.95
strokeMethod · 0.95
vertexMethod · 0.95

Tested by

no test coverage detected