Skip to content

Commit 9dfa95b

Browse files
authored
Merge pull request #5298 from JetStarBlues/groupDefaultMaterialTypeFunctions
Group materials on reference page
2 parents fac9b64 + 430f9c5 commit 9dfa95b

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

src/webgl/material.js

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -280,44 +280,6 @@ p5.prototype.resetShader = function() {
280280
return this;
281281
};
282282

283-
/**
284-
* Normal material for geometry is a material that is not affected by light.
285-
* It is not reflective and is a placeholder material often used for debugging.
286-
* Surfaces facing the X-axis, become red, those facing the Y-axis, become green and those facing the Z-axis, become blue.
287-
* You can view all possible materials in this
288-
* <a href="https://p5js.org/examples/3d-materials.html">example</a>.
289-
* @method normalMaterial
290-
* @chainable
291-
* @example
292-
* <div>
293-
* <code>
294-
* function setup() {
295-
* createCanvas(100, 100, WEBGL);
296-
* }
297-
*
298-
* function draw() {
299-
* background(200);
300-
* normalMaterial();
301-
* sphere(40);
302-
* }
303-
* </code>
304-
* </div>
305-
* @alt
306-
* Red, green and blue gradient.
307-
*/
308-
p5.prototype.normalMaterial = function(...args) {
309-
this._assert3d('normalMaterial');
310-
p5._validateParameters('normalMaterial', args);
311-
this._renderer.drawMode = constants.FILL;
312-
this._renderer._useSpecularMaterial = false;
313-
this._renderer._useEmissiveMaterial = false;
314-
this._renderer._useNormalMaterial = true;
315-
this._renderer.curFillColor = [1, 1, 1, 1];
316-
this._renderer._setProperty('_doFill', true);
317-
this.noStroke();
318-
return this;
319-
};
320-
321283
/**
322284
* Texture for geometry. You can view other possible materials in this
323285
* <a href="https://p5js.org/examples/3d-materials.html">example</a>.
@@ -568,6 +530,44 @@ p5.prototype.textureWrap = function(wrapX, wrapY = wrapX) {
568530
}
569531
};
570532

533+
/**
534+
* Normal material for geometry is a material that is not affected by light.
535+
* It is not reflective and is a placeholder material often used for debugging.
536+
* Surfaces facing the X-axis, become red, those facing the Y-axis, become green and those facing the Z-axis, become blue.
537+
* You can view all possible materials in this
538+
* <a href="https://p5js.org/examples/3d-materials.html">example</a>.
539+
* @method normalMaterial
540+
* @chainable
541+
* @example
542+
* <div>
543+
* <code>
544+
* function setup() {
545+
* createCanvas(100, 100, WEBGL);
546+
* }
547+
*
548+
* function draw() {
549+
* background(200);
550+
* normalMaterial();
551+
* sphere(40);
552+
* }
553+
* </code>
554+
* </div>
555+
* @alt
556+
* Red, green and blue gradient.
557+
*/
558+
p5.prototype.normalMaterial = function(...args) {
559+
this._assert3d('normalMaterial');
560+
p5._validateParameters('normalMaterial', args);
561+
this._renderer.drawMode = constants.FILL;
562+
this._renderer._useSpecularMaterial = false;
563+
this._renderer._useEmissiveMaterial = false;
564+
this._renderer._useNormalMaterial = true;
565+
this._renderer.curFillColor = [1, 1, 1, 1];
566+
this._renderer._setProperty('_doFill', true);
567+
this.noStroke();
568+
return this;
569+
};
570+
571571
/**
572572
* Ambient material for geometry with a given color. Ambient material defines the color the object reflects under any lighting.
573573
* For example, if the ambient material of an object is pure red, but the ambient lighting only contains green, the object will not reflect any light.

0 commit comments

Comments
 (0)