Sets the current normal vector. Used for drawing three-dimensional shapes and surfaces, normal() specifies a vector perpendicular to a shape's surface which, in turn, determines how lighting affects it. Processing attempts to automatically assign normals to shapes, but since that's imperfect,
(float nx, float ny, float nz)
| 1229 | * @see PGraphics#lights() |
| 1230 | */ |
| 1231 | public void normal(float nx, float ny, float nz) { |
| 1232 | normalX = nx; |
| 1233 | normalY = ny; |
| 1234 | normalZ = nz; |
| 1235 | |
| 1236 | // if drawing a shape and the normal hasn't been set yet, |
| 1237 | // then we need to set the normals for each vertex so far |
| 1238 | if (shape != 0) { |
| 1239 | if (normalMode == NORMAL_MODE_AUTO) { |
| 1240 | // One normal per begin/end shape |
| 1241 | normalMode = NORMAL_MODE_SHAPE; |
| 1242 | } else if (normalMode == NORMAL_MODE_SHAPE) { |
| 1243 | // a separate normal for each vertex |
| 1244 | normalMode = NORMAL_MODE_VERTEX; |
| 1245 | } |
| 1246 | } |
| 1247 | } |
| 1248 | |
| 1249 | |
| 1250 | public void attribPosition(String name, float x, float y, float z) { |