public void noTint() { if (!openShape) { PGraphics.showWarning(OUTSIDE_BEGIN_END_ERROR, "noTint()"); return; } tint = false; }
public void setTextureMode(int mode) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setTextureMode()"); return; } textureMode = mode; }
public void strokeCap(int cap) { if (!openShape) { PGraphics.showWarning(OUTSIDE_BEGIN_END_ERROR, "strokeCap()"); return; } strokeCap = cap; }
/** * @webref pshape:method * @brief Returns the total number of vertices as an int * @see PShape#getVertex(int) * @see PShape#setVertex(int, float, float) */ public int getVertexCount() { if (family == GROUP || family == PRIMITIVE) { PGraphics.showWarning(NO_VERTICES_ERROR); } return vertexCount; }
public void setNormal(int index, float nx, float ny, float nz) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setNormal()"); return; } vertices[index][PGraphics.NX] = nx; vertices[index][PGraphics.NY] = ny; vertices[index][PGraphics.NZ] = nz; }
public int getEmissive(int index) { // make sure we allocated the vertices array and that vertex exists if (vertices == null || index >= vertices.length) { PGraphics.showWarning(NO_SUCH_VERTEX_ERROR + " (" + index + ")", "getEmissive()"); return emissiveColor; } int r = (int) (vertices[index][PGraphics.ER] * 255); int g = (int) (vertices[index][PGraphics.EG] * 255); int b = (int) (vertices[index][PGraphics.EB] * 255); return 0xff000000 | (r << 16) | (g << 8) | b; }
@Override public void setNormal(int index, float nx, float ny, float nz) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setNormal()"); return; } inGeo.normals[3 * index + 0] = nx; inGeo.normals[3 * index + 1] = ny; inGeo.normals[3 * index + 2] = nz; markForTessellation(); }
@Override public void setShininess(int index, float shine) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setShininess()"); return; } inGeo.shininess[index] = shine; markForTessellation(); }
@Override public void vertex(float x, float y, float z) { vertexImpl(x, y, z, 0, 0); if (textureImage != null) PGraphics.showWarning(MISSING_UV_TEXCOORDS_ERROR); }
public void tint(float gray, float alpha) { if (!openShape) { PGraphics.showWarning(OUTSIDE_BEGIN_END_ERROR, "tint()"); return; } tint = true; colorCalc(gray, alpha); tintColor = calcColor; }
public void specular(float x, float y, float z) { if (!openShape) { PGraphics.showWarning(OUTSIDE_BEGIN_END_ERROR, "specular()"); return; } colorCalc(x, y, z); specularColor = calcColor; }
public void emissive(int rgb) { if (!openShape) { PGraphics.showWarning(OUTSIDE_BEGIN_END_ERROR, "emissive()"); return; } colorCalc(rgb); emissiveColor = calcColor; }
public void setAmbient(int ambient) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setAmbient()"); return; } ambientColor = ambient; if (vertices != null) { for (int i = 0; i < vertices.length; i++) { setAmbient(i, ambient); } } }
public void setSpecular(int specular) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setSpecular()"); return; } specularColor = specular; if (vertices != null) { for (int i = 0; i < vertices.length; i++) { setSpecular(i, specular); } } }
public void fill(float gray) { if (!openShape) { PGraphics.showWarning(OUTSIDE_BEGIN_END_ERROR, "fill()"); return; } fill = true; colorCalc(gray); fillColor = calcColor; if (!setAmbient) { ambientColor = fillColor; } }
public void stroke(float x, float y, float z) { if (!openShape) { PGraphics.showWarning(OUTSIDE_BEGIN_END_ERROR, "stroke()"); return; } stroke = true; colorCalc(x, y, z); strokeColor = calcColor; }
public void tint(int rgb) { if (!openShape) { PGraphics.showWarning(OUTSIDE_BEGIN_END_ERROR, "tint()"); return; } tint = true; colorCalc(rgb); tintColor = calcColor; }
public void tint(float x, float y, float z, float alpha) { if (!openShape) { PGraphics.showWarning(OUTSIDE_BEGIN_END_ERROR, "tint()"); return; } tint = true; colorCalc(x, y, z, alpha); tintColor = calcColor; }
public void setTint(int fill) { if (openShape) { PGraphics.showWarning(INSIDE_BEGIN_END_ERROR, "setTint()"); return; } tintColor = fill; if (vertices != null) { for (int i = 0; i < vertices.length; i++) { setFill(i, fill); } } }
@Override public PShape loadShape(String filename, String options) { String extension = PApplet.getExtension(filename); if (extension.equals("svg") || extension.equals("svgz")) { return new PShapeJava2D(parent.loadXML(filename)); } PGraphics.showWarning("Unsupported format: " + filename); return null; }