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

Method normal

core/src/processing/core/PGraphics.java:1231–1247  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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) {

Callers 2

boxMethod · 0.95
sphereMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected