p5 2.0.0-beta.6 → 2.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/p5.esm.js +75 -114
- package/lib/p5.js +75 -114
- package/lib/p5.min.js +1 -1
- package/package.json +1 -1
- package/src/accessibility/outputs.js +2 -2
- package/src/color/color_spaces/hsb.js +1 -1
- package/src/color/creating_reading.js +2 -1
- package/src/color/p5.Color.js +26 -19
- package/src/core/p5.Renderer.js +2 -0
- package/src/dom/dom.js +1 -1
- package/src/dom/p5.Element.js +2 -2
- package/src/image/p5.Image.js +8 -4
- package/src/webgl/light.js +1 -1
- package/src/webgl/p5.Camera.js +23 -25
- package/src/webgl/p5.Shader.js +11 -3
- package/src/webgl/p5.Texture.js +0 -7
- package/src/accessibility/color_namer.d.ts +0 -8
- package/src/accessibility/describe.d.ts +0 -174
- package/src/accessibility/gridOutput.d.ts +0 -8
- package/src/accessibility/outputs.d.ts +0 -215
- package/src/accessibility/textOutput.d.ts +0 -8
- package/src/color/color_conversion.d.ts +0 -47
- package/src/color/creating_reading.d.ts +0 -1348
- package/src/color/p5.Color.d.ts +0 -1078
- package/src/color/setting.d.ts +0 -1922
- package/src/core/constants.d.ts +0 -333
- package/src/core/environment.d.ts +0 -668
- package/src/core/friendly_errors/fes_core.d.ts +0 -8
- package/src/core/friendly_errors/file_errors.d.ts +0 -8
- package/src/core/friendly_errors/param_validator.d.ts +0 -54
- package/src/core/friendly_errors/sketch_reader.d.ts +0 -8
- package/src/core/friendly_errors/sketch_verifier.d.ts +0 -13
- package/src/core/friendly_errors/stacktrace.d.ts +0 -11
- package/src/core/friendly_errors/validate_params.d.ts +0 -8
- package/src/core/helpers.d.ts +0 -8
- package/src/core/legacy.d.ts +0 -8
- package/src/core/main.d.ts +0 -5947
- package/src/core/p5.Graphics.d.ts +0 -484
- package/src/core/p5.Renderer.d.ts +0 -42
- package/src/core/preload.d.ts +0 -45
- package/src/core/reference.d.ts +0 -8
- package/src/core/rendering.d.ts +0 -481
- package/src/core/structure.d.ts +0 -492
- package/src/core/transform.d.ts +0 -1638
- package/src/data/local_storage.d.ts +0 -323
- package/src/data/p5.TypedDict.d.ts +0 -292
- package/src/dom/dom.d.ts +0 -1295
- package/src/dom/p5.Element.d.ts +0 -2011
- package/src/dom/p5.File.d.ts +0 -13
- package/src/dom/p5.MediaElement.d.ts +0 -1249
- package/src/events/acceleration.d.ts +0 -193
- package/src/events/keyboard.d.ts +0 -499
- package/src/events/pointer.d.ts +0 -782
- package/src/image/filterRenderer2D.d.ts +0 -54
- package/src/image/image.d.ts +0 -326
- package/src/image/loading_displaying.d.ts +0 -580
- package/src/image/p5.Image.d.ts +0 -5882
- package/src/image/pixels.d.ts +0 -831
- package/src/io/files.d.ts +0 -1393
- package/src/io/p5.Table.d.ts +0 -1148
- package/src/io/p5.TableRow.d.ts +0 -294
- package/src/io/p5.XML.d.ts +0 -1188
- package/src/math/Matrices/Matrix.d.ts +0 -594
- package/src/math/Matrices/MatrixNumjs.d.ts +0 -8
- package/src/math/calculation.d.ts +0 -923
- package/src/math/math.d.ts +0 -108
- package/src/math/noise.d.ts +0 -311
- package/src/math/p5.Matrix.d.ts +0 -8
- package/src/math/p5.Vector.d.ts +0 -3399
- package/src/math/random.d.ts +0 -267
- package/src/math/trigonometry.d.ts +0 -660
- package/src/shape/2d_primitives.d.ts +0 -1033
- package/src/shape/attributes.d.ts +0 -466
- package/src/shape/curves.d.ts +0 -829
- package/src/shape/custom_shapes.d.ts +0 -401
- package/src/shape/vertex.d.ts +0 -1450
- package/src/type/p5.Font.d.ts +0 -54
- package/src/type/textCore.d.ts +0 -155
- package/src/utilities/array_functions.d.ts +0 -309
- package/src/utilities/conversion.d.ts +0 -894
- package/src/utilities/string_functions.d.ts +0 -751
- package/src/utilities/time_date.d.ts +0 -295
- package/src/utilities/utility_functions.d.ts +0 -587
- package/src/webgl/3d_primitives.d.ts +0 -1460
- package/src/webgl/interaction.d.ts +0 -371
- package/src/webgl/light.d.ts +0 -1184
- package/src/webgl/loading.d.ts +0 -533
- package/src/webgl/material.d.ts +0 -2673
- package/src/webgl/p5.Camera.d.ts +0 -2959
- package/src/webgl/p5.DataArray.d.ts +0 -61
- package/src/webgl/p5.Framebuffer.d.ts +0 -760
- package/src/webgl/p5.Geometry.d.ts +0 -1126
- package/src/webgl/p5.Quat.d.ts +0 -45
- package/src/webgl/p5.RendererGL.d.ts +0 -235
- package/src/webgl/p5.Shader.d.ts +0 -658
- package/src/webgl/p5.Texture.d.ts +0 -53
- package/src/webgl/text.d.ts +0 -74
- package/types/global.d.ts +0 -5527
- package/types/p5.d.ts +0 -6599
package/lib/p5.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! p5.js v2.0.0-beta.
|
|
1
|
+
/*! p5.js v2.0.0-beta.7 April 10, 2025 */
|
|
2
2
|
/**
|
|
3
3
|
* @module Constants
|
|
4
4
|
* @submodule Constants
|
|
@@ -12,7 +12,7 @@ const _PI = Math.PI;
|
|
|
12
12
|
* @property {String} VERSION
|
|
13
13
|
* @final
|
|
14
14
|
*/
|
|
15
|
-
const VERSION = '2.0.0-beta.
|
|
15
|
+
const VERSION = '2.0.0-beta.7';
|
|
16
16
|
|
|
17
17
|
// GRAPHICS RENDERER
|
|
18
18
|
/**
|
|
@@ -13396,7 +13396,7 @@ var HSBSpace = new ColorSpace({
|
|
|
13396
13396
|
toBase,
|
|
13397
13397
|
|
|
13398
13398
|
formats: {
|
|
13399
|
-
default
|
|
13399
|
+
default: {
|
|
13400
13400
|
type: 'custom',
|
|
13401
13401
|
serialize: (coords, alpha) => {
|
|
13402
13402
|
const rgb = toBase(coords);
|
|
@@ -13489,8 +13489,14 @@ function toBase(hsb){
|
|
|
13489
13489
|
*/
|
|
13490
13490
|
|
|
13491
13491
|
|
|
13492
|
-
const map = (n, start1, stop1, start2, stop2) =>
|
|
13493
|
-
((n - start1) / (stop1 - start1) * (stop2 - start2) + start2);
|
|
13492
|
+
const map = (n, start1, stop1, start2, stop2, clamp) => {
|
|
13493
|
+
let result = ((n - start1) / (stop1 - start1) * (stop2 - start2) + start2);
|
|
13494
|
+
if (clamp) {
|
|
13495
|
+
result = Math.max(result, Math.min(start2, stop2));
|
|
13496
|
+
result = Math.min(result, Math.max(start2, stop2));
|
|
13497
|
+
}
|
|
13498
|
+
return result;
|
|
13499
|
+
};
|
|
13494
13500
|
|
|
13495
13501
|
const serializationMap = {};
|
|
13496
13502
|
|
|
@@ -13522,7 +13528,7 @@ class Color {
|
|
|
13522
13528
|
Color.#grayscaleMap[mode] = definition.fromGray;
|
|
13523
13529
|
}
|
|
13524
13530
|
|
|
13525
|
-
constructor(vals, colorMode, colorMaxes) {
|
|
13531
|
+
constructor(vals, colorMode, colorMaxes, { clamp = false } = {}) {
|
|
13526
13532
|
// This changes with the color object
|
|
13527
13533
|
this.mode = colorMode || RGB;
|
|
13528
13534
|
|
|
@@ -13565,16 +13571,16 @@ class Color {
|
|
|
13565
13571
|
if(colorMaxes){
|
|
13566
13572
|
// NOTE: need to consider different number of arguments (eg. CMYK)
|
|
13567
13573
|
if(vals.length === 4){
|
|
13568
|
-
mappedVals = Color.mapColorRange(vals, this.mode, colorMaxes);
|
|
13574
|
+
mappedVals = Color.mapColorRange(vals, this.mode, colorMaxes, clamp);
|
|
13569
13575
|
}else if(vals.length === 3){
|
|
13570
|
-
mappedVals = Color.mapColorRange([vals[0], vals[1], vals[2]], this.mode, colorMaxes);
|
|
13576
|
+
mappedVals = Color.mapColorRange([vals[0], vals[1], vals[2]], this.mode, colorMaxes, clamp);
|
|
13571
13577
|
mappedVals.push(1);
|
|
13572
13578
|
}else if(vals.length === 2){
|
|
13573
13579
|
// Grayscale with alpha
|
|
13574
13580
|
if(Color.#grayscaleMap[this.mode]){
|
|
13575
|
-
mappedVals = Color.#grayscaleMap[this.mode](vals[0], colorMaxes);
|
|
13581
|
+
mappedVals = Color.#grayscaleMap[this.mode](vals[0], colorMaxes, clamp);
|
|
13576
13582
|
}else {
|
|
13577
|
-
mappedVals = Color.mapColorRange([vals[0], vals[0], vals[0]], this.mode, colorMaxes);
|
|
13583
|
+
mappedVals = Color.mapColorRange([vals[0], vals[0], vals[0]], this.mode, colorMaxes, clamp);
|
|
13578
13584
|
}
|
|
13579
13585
|
const alphaMaxes = Array.isArray(colorMaxes[colorMaxes.length-1]) ?
|
|
13580
13586
|
colorMaxes[colorMaxes.length-1] :
|
|
@@ -13585,15 +13591,16 @@ class Color {
|
|
|
13585
13591
|
alphaMaxes[0],
|
|
13586
13592
|
alphaMaxes[1],
|
|
13587
13593
|
0,
|
|
13588
|
-
1
|
|
13594
|
+
1,
|
|
13595
|
+
clamp
|
|
13589
13596
|
)
|
|
13590
13597
|
);
|
|
13591
13598
|
}else if(vals.length === 1){
|
|
13592
13599
|
// Grayscale only
|
|
13593
13600
|
if(Color.#grayscaleMap[this.mode]){
|
|
13594
|
-
mappedVals = Color.#grayscaleMap[this.mode](vals[0], colorMaxes);
|
|
13601
|
+
mappedVals = Color.#grayscaleMap[this.mode](vals[0], colorMaxes, clamp);
|
|
13595
13602
|
}else {
|
|
13596
|
-
mappedVals = Color.mapColorRange([vals[0], vals[0], vals[0]], this.mode, colorMaxes);
|
|
13603
|
+
mappedVals = Color.mapColorRange([vals[0], vals[0], vals[0]], this.mode, colorMaxes, clamp);
|
|
13597
13604
|
}
|
|
13598
13605
|
mappedVals.push(1);
|
|
13599
13606
|
}else {
|
|
@@ -13616,7 +13623,7 @@ class Color {
|
|
|
13616
13623
|
}
|
|
13617
13624
|
|
|
13618
13625
|
// Convert from p5 color range to color.js color range
|
|
13619
|
-
static mapColorRange(origin, mode, maxes){
|
|
13626
|
+
static mapColorRange(origin, mode, maxes, clamp){
|
|
13620
13627
|
const p5Maxes = maxes.map((max) => {
|
|
13621
13628
|
if(!Array.isArray(max)){
|
|
13622
13629
|
return [0, max];
|
|
@@ -13627,7 +13634,7 @@ class Color {
|
|
|
13627
13634
|
const colorjsMaxes = Color.#colorjsMaxes[mode];
|
|
13628
13635
|
|
|
13629
13636
|
return origin.map((channel, i) => {
|
|
13630
|
-
const newval = map(channel, p5Maxes[i][0], p5Maxes[i][1], colorjsMaxes[i][0], colorjsMaxes[i][1]);
|
|
13637
|
+
const newval = map(channel, p5Maxes[i][0], p5Maxes[i][1], colorjsMaxes[i][0], colorjsMaxes[i][1], clamp);
|
|
13631
13638
|
return newval;
|
|
13632
13639
|
});
|
|
13633
13640
|
}
|
|
@@ -14139,7 +14146,7 @@ function color$1(p5, fn, lifecycles){
|
|
|
14139
14146
|
*/
|
|
14140
14147
|
p5.Color = Color;
|
|
14141
14148
|
|
|
14142
|
-
sRGB.fromGray = P3.fromGray = function(val, maxes){
|
|
14149
|
+
sRGB.fromGray = P3.fromGray = function(val, maxes, clamp){
|
|
14143
14150
|
// Use blue max
|
|
14144
14151
|
const p5Maxes = maxes.map((max) => {
|
|
14145
14152
|
if(!Array.isArray(max)){
|
|
@@ -14149,11 +14156,11 @@ function color$1(p5, fn, lifecycles){
|
|
|
14149
14156
|
}
|
|
14150
14157
|
});
|
|
14151
14158
|
|
|
14152
|
-
const v = map(val, p5Maxes[2][0], p5Maxes[2][1], 0, 1);
|
|
14159
|
+
const v = map(val, p5Maxes[2][0], p5Maxes[2][1], 0, 1, clamp);
|
|
14153
14160
|
return [v, v, v];
|
|
14154
14161
|
};
|
|
14155
14162
|
|
|
14156
|
-
HSBSpace.fromGray = HSLSpace.fromGray = function(val, maxes){
|
|
14163
|
+
HSBSpace.fromGray = HSLSpace.fromGray = function(val, maxes, clamp){
|
|
14157
14164
|
// Use brightness max
|
|
14158
14165
|
const p5Maxes = maxes.map((max) => {
|
|
14159
14166
|
if(!Array.isArray(max)){
|
|
@@ -14163,11 +14170,11 @@ function color$1(p5, fn, lifecycles){
|
|
|
14163
14170
|
}
|
|
14164
14171
|
});
|
|
14165
14172
|
|
|
14166
|
-
const v = map(val, p5Maxes[2][0], p5Maxes[2][1], 0, 100);
|
|
14173
|
+
const v = map(val, p5Maxes[2][0], p5Maxes[2][1], 0, 100, clamp);
|
|
14167
14174
|
return [0, 0, v];
|
|
14168
14175
|
};
|
|
14169
14176
|
|
|
14170
|
-
HWBSpace.fromGray = function(val, maxes){
|
|
14177
|
+
HWBSpace.fromGray = function(val, maxes, clamp){
|
|
14171
14178
|
// Use Whiteness and Blackness to create number line
|
|
14172
14179
|
const p5Maxes = maxes.map((max) => {
|
|
14173
14180
|
if(!Array.isArray(max)){
|
|
@@ -14197,7 +14204,7 @@ function color$1(p5, fn, lifecycles){
|
|
|
14197
14204
|
LCHSpace.fromGray =
|
|
14198
14205
|
OKLab.fromGray =
|
|
14199
14206
|
OKLCHSpace.fromGray =
|
|
14200
|
-
function(val, maxes){
|
|
14207
|
+
function(val, maxes, clamp){
|
|
14201
14208
|
// Use lightness max
|
|
14202
14209
|
const p5Maxes = maxes.map((max) => {
|
|
14203
14210
|
if(!Array.isArray(max)){
|
|
@@ -14207,7 +14214,7 @@ function color$1(p5, fn, lifecycles){
|
|
|
14207
14214
|
}
|
|
14208
14215
|
});
|
|
14209
14216
|
|
|
14210
|
-
const v = map(val, p5Maxes[0][0], p5Maxes[0][1], 0, 100);
|
|
14217
|
+
const v = map(val, p5Maxes[0][0], p5Maxes[0][1], 0, 100, clamp);
|
|
14211
14218
|
return [v, 0, 0];
|
|
14212
14219
|
};
|
|
14213
14220
|
|
|
@@ -14708,7 +14715,8 @@ function creatingReading(p5, fn){
|
|
|
14708
14715
|
return new Color(
|
|
14709
14716
|
arg,
|
|
14710
14717
|
this._renderer.states.colorMode,
|
|
14711
|
-
this._renderer.states.colorMaxes[this._renderer.states.colorMode]
|
|
14718
|
+
this._renderer.states.colorMaxes[this._renderer.states.colorMode],
|
|
14719
|
+
{ clamp: true }
|
|
14712
14720
|
);
|
|
14713
14721
|
};
|
|
14714
14722
|
|
|
@@ -19116,9 +19124,9 @@ class Element {
|
|
|
19116
19124
|
// For details, see https://github.com/processing/p5.js/issues/3087.
|
|
19117
19125
|
const eventPrependedFxn = function (event) {
|
|
19118
19126
|
this._pInst.mouseIsPressed = true;
|
|
19119
|
-
this._pInst._activePointers.set(
|
|
19127
|
+
this._pInst._activePointers.set(event.pointerId, event);
|
|
19120
19128
|
this._pInst._setMouseButton(event);
|
|
19121
|
-
this._pInst._updatePointerCoords(
|
|
19129
|
+
this._pInst._updatePointerCoords(event);
|
|
19122
19130
|
// Pass along the return-value of the callback:
|
|
19123
19131
|
return fxn.call(this, event);
|
|
19124
19132
|
};
|
|
@@ -20802,6 +20810,8 @@ function blurARGB(canvas, radius) {
|
|
|
20802
20810
|
*/
|
|
20803
20811
|
|
|
20804
20812
|
|
|
20813
|
+
let fnRef;
|
|
20814
|
+
|
|
20805
20815
|
class Image {
|
|
20806
20816
|
constructor(width, height) {
|
|
20807
20817
|
this.width = width;
|
|
@@ -21723,7 +21733,7 @@ class Image {
|
|
|
21723
21733
|
* @param {Integer} dh
|
|
21724
21734
|
*/
|
|
21725
21735
|
copy(...args) {
|
|
21726
|
-
|
|
21736
|
+
fnRef.copy.apply(this, args);
|
|
21727
21737
|
}
|
|
21728
21738
|
|
|
21729
21739
|
/**
|
|
@@ -22157,7 +22167,7 @@ class Image {
|
|
|
22157
22167
|
*/
|
|
22158
22168
|
blend(...args) {
|
|
22159
22169
|
// p5._validateParameters('p5.Image.blend', arguments);
|
|
22160
|
-
|
|
22170
|
+
fnRef.blend.apply(this, args);
|
|
22161
22171
|
this.setModified(true);
|
|
22162
22172
|
}
|
|
22163
22173
|
|
|
@@ -22243,9 +22253,9 @@ class Image {
|
|
|
22243
22253
|
*/
|
|
22244
22254
|
save(filename, extension) {
|
|
22245
22255
|
if (this.gifProperties) {
|
|
22246
|
-
|
|
22256
|
+
fnRef.encodeAndDownloadGif(this, filename);
|
|
22247
22257
|
} else {
|
|
22248
|
-
|
|
22258
|
+
fnRef.saveCanvas(this.canvas, filename, extension);
|
|
22249
22259
|
}
|
|
22250
22260
|
}
|
|
22251
22261
|
|
|
@@ -22603,6 +22613,8 @@ class Image {
|
|
|
22603
22613
|
}
|
|
22604
22614
|
}
|
|
22605
22615
|
function image$2(p5, fn){
|
|
22616
|
+
fnRef = fn;
|
|
22617
|
+
|
|
22606
22618
|
/**
|
|
22607
22619
|
* A class to describe an image.
|
|
22608
22620
|
*
|
|
@@ -22865,7 +22877,7 @@ function image$2(p5, fn){
|
|
|
22865
22877
|
}
|
|
22866
22878
|
|
|
22867
22879
|
if(typeof p5 !== 'undefined'){
|
|
22868
|
-
image$2(p5);
|
|
22880
|
+
image$2(p5, p5.prototype);
|
|
22869
22881
|
}
|
|
22870
22882
|
|
|
22871
22883
|
/**
|
|
@@ -25326,6 +25338,7 @@ function renderer(p5, fn){
|
|
|
25326
25338
|
* @param {HTMLElement} elt DOM node that is wrapped
|
|
25327
25339
|
* @param {p5} [pInst] pointer to p5 instance
|
|
25328
25340
|
* @param {Boolean} [isMainCanvas] whether we're using it as main canvas
|
|
25341
|
+
* @private
|
|
25329
25342
|
*/
|
|
25330
25343
|
p5.Renderer = Renderer;
|
|
25331
25344
|
}
|
|
@@ -48277,31 +48290,29 @@ class Camera {
|
|
|
48277
48290
|
*
|
|
48278
48291
|
* // Move the camera along its "local" axes
|
|
48279
48292
|
* // when the user presses certain keys.
|
|
48280
|
-
* if (keyIsPressed === true) {
|
|
48281
48293
|
*
|
|
48282
|
-
*
|
|
48283
|
-
*
|
|
48284
|
-
*
|
|
48285
|
-
*
|
|
48286
|
-
*
|
|
48287
|
-
*
|
|
48288
|
-
*
|
|
48294
|
+
* // Move horizontally.
|
|
48295
|
+
* if (keyIsDown(LEFT_ARROW)) {
|
|
48296
|
+
* cam.move(-1, 0, 0);
|
|
48297
|
+
* }
|
|
48298
|
+
* if (keyIsDown(RIGHT_ARROW)) {
|
|
48299
|
+
* cam.move(1, 0, 0);
|
|
48300
|
+
* }
|
|
48289
48301
|
*
|
|
48290
|
-
*
|
|
48291
|
-
*
|
|
48292
|
-
*
|
|
48293
|
-
*
|
|
48294
|
-
*
|
|
48295
|
-
*
|
|
48296
|
-
*
|
|
48302
|
+
* // Move vertically.
|
|
48303
|
+
* if (keyIsDown(UP_ARROW)) {
|
|
48304
|
+
* cam.move(0, -1, 0);
|
|
48305
|
+
* }
|
|
48306
|
+
* if (keyIsDown(DOWN_ARROW)) {
|
|
48307
|
+
* cam.move(0, 1, 0);
|
|
48308
|
+
* }
|
|
48297
48309
|
*
|
|
48298
|
-
*
|
|
48299
|
-
*
|
|
48300
|
-
*
|
|
48301
|
-
*
|
|
48302
|
-
*
|
|
48303
|
-
*
|
|
48304
|
-
* }
|
|
48310
|
+
* // Move in/out of the screen.
|
|
48311
|
+
* if (keyIsDown('i')) {
|
|
48312
|
+
* cam.move(0, 0, -1);
|
|
48313
|
+
* }
|
|
48314
|
+
* if (keyIsDown('o')) {
|
|
48315
|
+
* cam.move(0, 0, 1);
|
|
48305
48316
|
* }
|
|
48306
48317
|
*
|
|
48307
48318
|
* // Draw the box.
|
|
@@ -50665,7 +50676,7 @@ class Shader {
|
|
|
50665
50676
|
* <a href="#/p5.Graphics">p5.Graphics</a>, as in
|
|
50666
50677
|
* `myShader.copyToContext(pg)`. The shader can also be copied from a
|
|
50667
50678
|
* <a href="#/p5.Graphics">p5.Graphics</a> object to the main canvas using
|
|
50668
|
-
* the `
|
|
50679
|
+
* the `p5.instance` variable, as in `myShader.copyToContext(p5.instance)`.
|
|
50669
50680
|
*
|
|
50670
50681
|
* Note: A <a href="#/p5.Shader">p5.Shader</a> object created with
|
|
50671
50682
|
* <a href="#/p5/createShader">createShader()</a>,
|
|
@@ -50806,7 +50817,7 @@ class Shader {
|
|
|
50806
50817
|
* pg.shader(original);
|
|
50807
50818
|
*
|
|
50808
50819
|
* // Copy the original shader to the main canvas.
|
|
50809
|
-
* copied = original.copyToContext(
|
|
50820
|
+
* copied = original.copyToContext(p5.instance);
|
|
50810
50821
|
*
|
|
50811
50822
|
* // Apply the copied shader to the main canvas.
|
|
50812
50823
|
* shader(copied);
|
|
@@ -50982,7 +50993,12 @@ class Shader {
|
|
|
50982
50993
|
|
|
50983
50994
|
for (const uniform of this.samplers) {
|
|
50984
50995
|
let tex = uniform.texture;
|
|
50985
|
-
if (
|
|
50996
|
+
if (
|
|
50997
|
+
tex === undefined ||
|
|
50998
|
+
(
|
|
50999
|
+
false
|
|
51000
|
+
)
|
|
51001
|
+
) {
|
|
50986
51002
|
// user hasn't yet supplied a texture for this slot.
|
|
50987
51003
|
// (or there may not be one--maybe just lighting),
|
|
50988
51004
|
// so we supply a default texture instead.
|
|
@@ -58892,7 +58908,7 @@ function light(p5, fn){
|
|
|
58892
58908
|
* // Load an image and create a p5.Image object.
|
|
58893
58909
|
* img = await loadImage('assets/outdoor_spheremap.jpg');
|
|
58894
58910
|
*
|
|
58895
|
-
* createCanvas(100 ,
|
|
58911
|
+
* createCanvas(100, 100, WEBGL);
|
|
58896
58912
|
*
|
|
58897
58913
|
* describe('A sphere floating above a landscape. The surface of the sphere reflects the landscape. The full landscape is viewable in 3D as the user drags the mouse.');
|
|
58898
58914
|
* }
|
|
@@ -65241,8 +65257,6 @@ class Texture {
|
|
|
65241
65257
|
* Initializes common texture parameters, creates a gl texture,
|
|
65242
65258
|
* tries to upload the texture for the first time if data is
|
|
65243
65259
|
* already available.
|
|
65244
|
-
* @private
|
|
65245
|
-
* @method init
|
|
65246
65260
|
*/
|
|
65247
65261
|
init (data) {
|
|
65248
65262
|
const gl = this._renderer.GL;
|
|
@@ -65297,7 +65311,6 @@ class Texture {
|
|
|
65297
65311
|
* easy to do so) and reuploads the texture if necessary. If it's not
|
|
65298
65312
|
* possible or to expensive to do a calculation to determine wheter or
|
|
65299
65313
|
* not the data has occurred, this method simply re-uploads the texture.
|
|
65300
|
-
* @method update
|
|
65301
65314
|
*/
|
|
65302
65315
|
update () {
|
|
65303
65316
|
const data = this.src;
|
|
@@ -65396,7 +65409,6 @@ class Texture {
|
|
|
65396
65409
|
|
|
65397
65410
|
/**
|
|
65398
65411
|
* Binds the texture to the appropriate GL target.
|
|
65399
|
-
* @method bindTexture
|
|
65400
65412
|
*/
|
|
65401
65413
|
bindTexture () {
|
|
65402
65414
|
// bind texture using gl context + glTarget and
|
|
@@ -65409,7 +65421,6 @@ class Texture {
|
|
|
65409
65421
|
|
|
65410
65422
|
/**
|
|
65411
65423
|
* Unbinds the texture from the appropriate GL target.
|
|
65412
|
-
* @method unbindTexture
|
|
65413
65424
|
*/
|
|
65414
65425
|
unbindTexture () {
|
|
65415
65426
|
// unbind per above, disable texturing on glTarget
|
|
@@ -65429,7 +65440,6 @@ class Texture {
|
|
|
65429
65440
|
* Sets how a texture is be interpolated when upscaled or downscaled.
|
|
65430
65441
|
* Nearest filtering uses nearest neighbor scaling when interpolating
|
|
65431
65442
|
* Linear filtering uses WebGL's linear scaling when interpolating
|
|
65432
|
-
* @method setInterpolation
|
|
65433
65443
|
* @param {String} downScale Specifies the texture filtering when
|
|
65434
65444
|
* textures are shrunk. Options are LINEAR or NEAREST
|
|
65435
65445
|
* @param {String} upScale Specifies the texture filtering when
|
|
@@ -65462,7 +65472,6 @@ class Texture {
|
|
|
65462
65472
|
* when their uv's go outside of the 0 - 1 range. There are three options:
|
|
65463
65473
|
* CLAMP, REPEAT, and MIRROR. REPEAT & MIRROR are only available if the texture
|
|
65464
65474
|
* is a power of two size (128, 256, 512, 1024, etc.).
|
|
65465
|
-
* @method setWrapMode
|
|
65466
65475
|
* @param {String} wrapX Controls the horizontal texture wrapping behavior
|
|
65467
65476
|
* @param {String} wrapY Controls the vertical texture wrapping behavior
|
|
65468
65477
|
*/
|
|
@@ -71558,7 +71567,7 @@ function outputs(p5, fn){
|
|
|
71558
71567
|
|
|
71559
71568
|
//gets position of shape in the canvas
|
|
71560
71569
|
fn._getPos = function (x, y) {
|
|
71561
|
-
const { x: transformedX, y: transformedY } = this.worldToScreen(new
|
|
71570
|
+
const { x: transformedX, y: transformedY } = this.worldToScreen(new p5.Vector(x, y));
|
|
71562
71571
|
const canvasWidth = this.width;
|
|
71563
71572
|
const canvasHeight = this.height;
|
|
71564
71573
|
if (transformedX < 0.4 * canvasWidth) {
|
|
@@ -71675,7 +71684,7 @@ function outputs(p5, fn){
|
|
|
71675
71684
|
];
|
|
71676
71685
|
// Apply the inverse of the current transformations to the canvas corners
|
|
71677
71686
|
const currentTransform = this._renderer.isP3D ?
|
|
71678
|
-
new DOMMatrix(this._renderer.
|
|
71687
|
+
new DOMMatrix(this._renderer.uMVMatrix.mat4) :
|
|
71679
71688
|
this.drawingContext.getTransform();
|
|
71680
71689
|
const invertedTransform = currentTransform.inverse();
|
|
71681
71690
|
const tc = canvasCorners.map(
|
|
@@ -81672,12 +81681,6 @@ var p5$1 = {
|
|
|
81672
81681
|
]
|
|
81673
81682
|
]
|
|
81674
81683
|
},
|
|
81675
|
-
calculateOffset: {
|
|
81676
|
-
overloads: [
|
|
81677
|
-
[
|
|
81678
|
-
]
|
|
81679
|
-
]
|
|
81680
|
-
},
|
|
81681
81684
|
createCanvas: {
|
|
81682
81685
|
overloads: [
|
|
81683
81686
|
[
|
|
@@ -84436,40 +84439,6 @@ var p5$1 = {
|
|
|
84436
84439
|
]
|
|
84437
84440
|
]
|
|
84438
84441
|
},
|
|
84439
|
-
update: {
|
|
84440
|
-
overloads: [
|
|
84441
|
-
[
|
|
84442
|
-
]
|
|
84443
|
-
]
|
|
84444
|
-
},
|
|
84445
|
-
bindTexture: {
|
|
84446
|
-
overloads: [
|
|
84447
|
-
[
|
|
84448
|
-
]
|
|
84449
|
-
]
|
|
84450
|
-
},
|
|
84451
|
-
unbindTexture: {
|
|
84452
|
-
overloads: [
|
|
84453
|
-
[
|
|
84454
|
-
]
|
|
84455
|
-
]
|
|
84456
|
-
},
|
|
84457
|
-
setInterpolation: {
|
|
84458
|
-
overloads: [
|
|
84459
|
-
[
|
|
84460
|
-
"String",
|
|
84461
|
-
"String"
|
|
84462
|
-
]
|
|
84463
|
-
]
|
|
84464
|
-
},
|
|
84465
|
-
setWrapMode: {
|
|
84466
|
-
overloads: [
|
|
84467
|
-
[
|
|
84468
|
-
"String",
|
|
84469
|
-
"String"
|
|
84470
|
-
]
|
|
84471
|
-
]
|
|
84472
|
-
},
|
|
84473
84442
|
remove: {
|
|
84474
84443
|
overloads: [
|
|
84475
84444
|
[
|
|
@@ -84624,14 +84593,6 @@ var dataDoc = {
|
|
|
84624
84593
|
]
|
|
84625
84594
|
]
|
|
84626
84595
|
}
|
|
84627
|
-
},
|
|
84628
|
-
"p5.Renderer": {
|
|
84629
|
-
resize: {
|
|
84630
|
-
overloads: [
|
|
84631
|
-
[
|
|
84632
|
-
]
|
|
84633
|
-
]
|
|
84634
|
-
}
|
|
84635
84596
|
},
|
|
84636
84597
|
"p5.Element": {
|
|
84637
84598
|
remove: {
|
|
@@ -95956,7 +95917,7 @@ function dom$1(p5, fn){
|
|
|
95956
95917
|
inst.push();
|
|
95957
95918
|
if (value) {
|
|
95958
95919
|
if (value.mode) {
|
|
95959
|
-
inst.colorMode(value.mode, ...value?.maxes[value.mode]);
|
|
95920
|
+
inst.colorMode(value.mode, ...(value?.maxes ? value.maxes[value.mode] || [] : []));
|
|
95960
95921
|
}
|
|
95961
95922
|
}
|
|
95962
95923
|
const c = inst.color(this.elt.value);
|