Set (U, V) coords for the next vertex in the current shape. This is ugly as its own function, and will (almost?) always be coincident with a call to vertex. As of beta, this was moved to the protected method you see here, and called from an optional param of and overloaded vertex(). The paramet
(float u, float v)
| 1661 | * Used by both PGraphics2D (for images) and PGraphics3D. |
| 1662 | */ |
| 1663 | protected void vertexTexture(float u, float v) { |
| 1664 | if (textureImage == null) { |
| 1665 | throw new RuntimeException("You must first call texture() before " + |
| 1666 | "using u and v coordinates with vertex()"); |
| 1667 | } |
| 1668 | if (textureMode == IMAGE) { |
| 1669 | u /= textureImage.width; |
| 1670 | v /= textureImage.height; |
| 1671 | } |
| 1672 | |
| 1673 | textureU = u; |
| 1674 | textureV = v; |
| 1675 | |
| 1676 | if (textureU < 0) textureU = 0; |
| 1677 | else if (textureU > 1) textureU = 1; |
| 1678 | |
| 1679 | if (textureV < 0) textureV = 0; |
| 1680 | else if (textureV > 1) textureV = 1; |
| 1681 | } |
| 1682 | |
| 1683 | |
| 1684 | // /** This feature is in testing, do not use or rely upon its implementation */ |