Skip to content

Commit

Permalink
Revert whitespace changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Orasund committed Jul 8, 2024
1 parent 437c8f5 commit 3dd6ddf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions src/math/random.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ const c = 1013904223;
let y2 = 0;

// Linear Congruential Generator that stores its state at instance[stateProperty]
p5.prototype._lcg = function (stateProperty) {
p5.prototype._lcg = function(stateProperty) {
// define the recurrence relationship
this[stateProperty] = (a * this[stateProperty] + c) % m;
// return a float in [0, 1)
// we've just used % m, so / m is always < 1
return this[stateProperty] / m;
};

p5.prototype._lcgSetSeed = function (stateProperty, val) {
p5.prototype._lcgSetSeed = function(stateProperty, val) {
// pick a random seed if val is undefined or null
// the >>> 0 casts the seed to an unsigned 32-bit integer
this[stateProperty] = (val == null ? Math.random() * m : val) >>> 0;
Expand Down Expand Up @@ -78,7 +78,7 @@ p5.prototype._lcgSetSeed = function (stateProperty, val) {
* </code>
* </div>
*/
p5.prototype.randomSeed = function (seed) {
p5.prototype.randomSeed = function(seed) {
this._lcgSetSeed(randomStateProp, seed);
this._gaussian_previous = false;
};
Expand Down Expand Up @@ -261,7 +261,7 @@ p5.prototype.randomSeed = function (seed) {
* @param {Array} choices array to choose from.
* @return {*} random element from the array.
*/
p5.prototype.random = function (min, max) {
p5.prototype.random = function(min, max) {
p5._validateParameters('random', arguments);
let rand;

Expand Down Expand Up @@ -351,7 +351,7 @@ p5.prototype.random = function (min, max) {
* </code>
* </div>
*/
p5.prototype.randomGaussian = function (mean, sd = 1) {
p5.prototype.randomGaussian = function(mean, sd = 1) {
let y1, x1, x2, w;
if (this._gaussian_previous) {
y1 = y2;
Expand Down
2 changes: 1 addition & 1 deletion src/webgl/material.js
Original file line number Diff line number Diff line change
Expand Up @@ -2336,7 +2336,7 @@ p5.prototype.metalness = function (metallic) {
* transparency internally, e.g. via vertex colors
* @return {Number[]} Normalized numbers array
*/
p5.RendererGL.prototype._applyColorBlend = function (colors, hasTransparency) {
p5.RendererGL.prototype._applyColorBlend = function(colors, hasTransparency) {
const gl = this.GL;

const isTexture = this.drawMode === constants.TEXTURE;
Expand Down
10 changes: 5 additions & 5 deletions src/webgl/p5.Quat.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ p5.Quat = class {
* @chainable
*/
static fromAxisAngle(angle, x, y, z) {
const w = Math.cos(angle / 2);
const vec = new p5.Vector(x, y, z).normalize().mult(Math.sin(angle / 2));
const w = Math.cos(angle/2);
const vec = new p5.Vector(x, y, z).normalize().mult(Math.sin(angle/2));
return new p5.Quat(w, vec.x, vec.y, vec.z);
}

Expand Down Expand Up @@ -71,9 +71,9 @@ p5.Quat = class {
* @param {p5.Vector} [p] vector to rotate on the axis quaternion
*/
rotateVector(p) {
return new p5.Vector.mult(p, this.w * this.w - this.vec.dot(this.vec))
.add(p5.Vector.mult(this.vec, 2 * p.dot(this.vec)))
.add(p5.Vector.mult(this.vec, 2 * this.w).cross(p))
return new p5.Vector.mult( p, this.w*this.w - this.vec.dot(this.vec) )
.add( p5.Vector.mult( this.vec, 2 * p.dot(this.vec) ) )
.add( p5.Vector.mult( this.vec, 2 * this.w ).cross( p ) )
.clampToZero();
}

Expand Down
30 changes: 15 additions & 15 deletions src/webgl/p5.RendererGL.Immediate.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import './p5.RenderBuffer';
* and TESS(WEBGL only)
* @chainable
*/
p5.RendererGL.prototype.beginShape = function (mode) {
p5.RendererGL.prototype.beginShape = function(mode) {
this.immediateMode.shapeMode =
mode !== undefined ? mode : constants.TESS;
this.immediateMode.geometry.reset();
Expand All @@ -46,7 +46,7 @@ const immediateBufferStrides = {
uvs: 2
};

p5.RendererGL.prototype.beginContour = function () {
p5.RendererGL.prototype.beginContour = function() {
if (this.immediateMode.shapeMode !== constants.TESS) {
throw new Error('WebGL mode can only use contours with beginShape(TESS).');
}
Expand All @@ -65,7 +65,7 @@ p5.RendererGL.prototype.beginContour = function () {
* @chainable
* @TODO implement handling of <a href="#/p5.Vector">p5.Vector</a> args
*/
p5.RendererGL.prototype.vertex = function (x, y) {
p5.RendererGL.prototype.vertex = function(x, y) {
// WebGL 1 doesn't support QUADS or QUAD_STRIP, so we duplicate data to turn
// QUADS into TRIANGLES and QUAD_STRIP into TRIANGLE_STRIP. (There is no extra
// work to convert QUAD_STRIP here, since the only difference is in how edges
Expand Down Expand Up @@ -139,15 +139,15 @@ p5.RendererGL.prototype.vertex = function (x, y) {
this.userStrokeShader !== undefined ||
this.userPointShader !== undefined
) {
// Do nothing if user-defined shaders are present
// Do nothing if user-defined shaders are present
} else if (
this._tex === null &&
arguments.length >= 4
) {
// Only throw this warning if custom uv's have been provided
console.warn(
'You must first call texture() before using' +
' vertex() with image based u and v coordinates'
' vertex() with image based u and v coordinates'
);
}
}
Expand Down Expand Up @@ -178,7 +178,7 @@ p5.RendererGL.prototype.vertex = function (x, y) {
* @param {Vector} v
* @chainable
*/
p5.RendererGL.prototype.normal = function (xorv, y, z) {
p5.RendererGL.prototype.normal = function(xorv, y, z) {
if (xorv instanceof p5.Vector) {
this._currentNormal = xorv;
} else {
Expand All @@ -192,7 +192,7 @@ p5.RendererGL.prototype.normal = function (xorv, y, z) {
* End shape drawing and render vertices to screen.
* @chainable
*/
p5.RendererGL.prototype.endShape = function (
p5.RendererGL.prototype.endShape = function(
mode,
isCurve,
isBezier,
Expand All @@ -212,7 +212,7 @@ p5.RendererGL.prototype.endShape = function (
// but in case of triangle we can skip the breaking into small triangle
// this can optimize performance by skipping the step of breaking it into triangles
if (this.immediateMode.geometry.vertices.length === 3 &&
this.immediateMode.shapeMode === constants.TESS
this.immediateMode.shapeMode === constants.TESS
) {
this.immediateMode.shapeMode === constants.TRIANGLES;
}
Expand Down Expand Up @@ -280,7 +280,7 @@ p5.RendererGL.prototype.endShape = function (
* POINTS,LINES,LINE_STRIP,LINE_LOOP,TRIANGLES,
* TRIANGLE_STRIP, TRIANGLE_FAN and TESS(WEBGL only)
*/
p5.RendererGL.prototype._processVertices = function (mode) {
p5.RendererGL.prototype._processVertices = function(mode) {
if (this.immediateMode.geometry.vertices.length === 0) return;

const calculateStroke = this._doStroke;
Expand Down Expand Up @@ -323,7 +323,7 @@ p5.RendererGL.prototype._processVertices = function (mode) {
* @private
* @returns {Number[]} indices for custom shape vertices indicating edges.
*/
p5.RendererGL.prototype._calculateEdges = function (
p5.RendererGL.prototype._calculateEdges = function(
shapeMode,
verts,
shouldClose
Expand Down Expand Up @@ -409,7 +409,7 @@ p5.RendererGL.prototype._calculateEdges = function (
* Called from _processVertices() when applicable. This function tesselates immediateMode.geometry.
* @private
*/
p5.RendererGL.prototype._tesselateShape = function () {
p5.RendererGL.prototype._tesselateShape = function() {
// TODO: handle non-TESS shape modes that have contours
this.immediateMode.shapeMode = constants.TRIANGLES;
const contours = [[]];
Expand All @@ -421,7 +421,7 @@ p5.RendererGL.prototype._tesselateShape = function () {
this.immediateMode.contourIndices.shift();
contours.push([]);
}
contours[contours.length - 1].push(
contours[contours.length-1].push(
this.immediateMode.geometry.vertices[i].x,
this.immediateMode.geometry.vertices[i].y,
this.immediateMode.geometry.vertices[i].z,
Expand Down Expand Up @@ -486,7 +486,7 @@ p5.RendererGL.prototype._tesselateShape = function () {
const dX = orig.x - vert.x;
const dY = orig.y - vert.y;
const dZ = orig.z - vert.z;
const dist = dX * dX + dY * dY + dZ * dZ;
const dist = dX*dX + dY*dY + dZ*dZ;
if (dist < closestDist) {
closestDist = dist;
closestIndex = i;
Expand All @@ -507,7 +507,7 @@ p5.RendererGL.prototype._tesselateShape = function () {
* enabling all appropriate buffers, applying color blend, and drawing the fill geometry.
* @private
*/
p5.RendererGL.prototype._drawImmediateFill = function (count = 1) {
p5.RendererGL.prototype._drawImmediateFill = function(count = 1) {
const gl = this.GL;
this._useVertexColor = (this.immediateMode.geometry.vertexColors.length > 0);

Expand Down Expand Up @@ -554,7 +554,7 @@ p5.RendererGL.prototype._drawImmediateFill = function (count = 1) {
* enabling all appropriate buffers, applying color blend, and drawing the stroke geometry.
* @private
*/
p5.RendererGL.prototype._drawImmediateStroke = function () {
p5.RendererGL.prototype._drawImmediateStroke = function() {
const gl = this.GL;

this._useLineColor =
Expand Down

0 comments on commit 3dd6ddf

Please sign in to comment.