( begin auto-generated from normal.xml ) Sets the current normal vector. This is for drawing three dimensional shapes and surfaces and specifies a vector perpendicular to the surface of the shape which determines how lighting affects it. Processing attempts to automatically assign normals to shapes
(float nx, float ny, float nz)
| 1263 | * @see PGraphics#lights() |
| 1264 | */ |
| 1265 | public void normal(float nx, float ny, float nz) { |
| 1266 | normalX = nx; |
| 1267 | normalY = ny; |
| 1268 | normalZ = nz; |
| 1269 | |
| 1270 | // if drawing a shape and the normal hasn't been set yet, |
| 1271 | // then we need to set the normals for each vertex so far |
| 1272 | if (shape != 0) { |
| 1273 | if (normalMode == NORMAL_MODE_AUTO) { |
| 1274 | // One normal per begin/end shape |
| 1275 | normalMode = NORMAL_MODE_SHAPE; |
| 1276 | } else if (normalMode == NORMAL_MODE_SHAPE) { |
| 1277 | // a separate normal for each vertex |
| 1278 | normalMode = NORMAL_MODE_VERTEX; |
| 1279 | } |
| 1280 | } |
| 1281 | } |
| 1282 | |
| 1283 | |
| 1284 | public void attribPosition(String name, float x, float y, float z) { |