p5 2.2.2 → 2.2.3-rc.0
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/dist/accessibility/color_namer.js +5 -5
- package/dist/accessibility/index.js +5 -5
- package/dist/app.js +5 -5
- package/dist/color/color_conversion.js +5 -5
- package/dist/color/index.js +1 -1
- package/dist/color/setting.js +1 -1
- package/dist/{constants-BxjhKpTv.js → constants-D3ryGa0m.js} +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +7 -3
- package/dist/core/filterShaders.js +1 -1
- package/dist/core/friendly_errors/fes_core.js +1 -1
- package/dist/core/friendly_errors/file_errors.js +1 -1
- package/dist/core/friendly_errors/index.js +1 -1
- package/dist/core/friendly_errors/param_validator.js +2063 -2014
- package/dist/core/friendly_errors/sketch_verifier.js +1 -1
- package/dist/core/helpers.js +1 -1
- package/dist/core/init.js +5 -5
- package/dist/core/internationalization.js +1 -1
- package/dist/core/legacy.js +5 -5
- package/dist/core/main.js +5 -5
- package/dist/core/p5.Graphics.js +3 -3
- package/dist/core/p5.Renderer.js +2 -2
- package/dist/core/p5.Renderer2D.js +5 -5
- package/dist/core/p5.Renderer3D.js +3 -3
- package/dist/core/rendering.js +3 -3
- package/dist/dom/dom.js +1 -1
- package/dist/dom/index.js +1 -1
- package/dist/dom/p5.Element.js +1 -1
- package/dist/dom/p5.MediaElement.js +11 -4
- package/dist/events/pointer.js +4 -0
- package/dist/image/const.js +1 -1
- package/dist/image/filterRenderer2D.js +4 -4
- package/dist/image/image.js +3 -3
- package/dist/image/index.js +3 -3
- package/dist/image/loading_displaying.js +3 -3
- package/dist/image/p5.Image.js +2 -2
- package/dist/io/files.js +3 -3
- package/dist/io/index.js +3 -3
- package/dist/{ir_builders-w12-GSxu.js → ir_builders-DMfaOLIL.js} +48 -8
- package/dist/{main-DDs4QOnh.js → main-CGwYa9-f.js} +126 -36
- package/dist/math/Matrices/Matrix.js +1 -1
- package/dist/math/Matrices/MatrixNumjs.js +1 -1
- package/dist/math/index.js +1 -1
- package/dist/math/p5.Matrix.js +1 -1
- package/dist/math/p5.Vector.js +1 -1
- package/dist/math/trigonometry.js +1 -1
- package/dist/{p5.Renderer-BSGddFv7.js → p5.Renderer-C0e0XesC.js} +9 -2
- package/dist/{rendering-C9g7uSQ5.js → rendering-4Z2qdE_W.js} +90 -55
- package/dist/shape/2d_primitives.js +1 -1
- package/dist/shape/attributes.js +1 -1
- package/dist/shape/custom_shapes.js +1 -1
- package/dist/shape/index.js +1 -1
- package/dist/strands/ir_builders.js +1 -1
- package/dist/strands/ir_dag.js +32 -2
- package/dist/strands/ir_types.js +18 -11
- package/dist/strands/p5.strands.js +15 -2
- package/dist/strands/strands_api.js +86 -40
- package/dist/strands/strands_conditionals.js +1 -1
- package/dist/strands/strands_for.js +1 -1
- package/dist/strands/strands_node.js +1 -1
- package/dist/strands/strands_phi_utils.js +27 -9
- package/dist/strands/strands_transpiler.js +1237 -831
- package/dist/type/index.js +2 -2
- package/dist/type/p5.Font.js +7 -5
- package/dist/type/textCore.js +2 -2
- package/dist/webgl/3d_primitives.js +3 -3
- package/dist/webgl/GeometryBuilder.js +1 -1
- package/dist/webgl/ShapeBuilder.js +1 -1
- package/dist/webgl/enums.js +1 -1
- package/dist/webgl/index.js +4 -4
- package/dist/webgl/interaction.js +1 -1
- package/dist/webgl/light.js +3 -3
- package/dist/webgl/loading.js +41 -35
- package/dist/webgl/material.js +3 -3
- package/dist/webgl/p5.Camera.js +3 -3
- package/dist/webgl/p5.Framebuffer.js +3 -3
- package/dist/webgl/p5.Geometry.js +1 -1
- package/dist/webgl/p5.Quat.js +1 -1
- package/dist/webgl/p5.RendererGL.js +4 -4
- package/dist/webgl/p5.Texture.js +3 -3
- package/dist/webgl/strands_glslBackend.js +1 -1
- package/dist/webgl/text.js +3 -3
- package/dist/webgl/utils.js +3 -3
- package/dist/webgpu/index.js +2 -2
- package/dist/webgpu/p5.RendererWebGPU.js +2 -2
- package/dist/webgpu/strands_wgslBackend.js +13 -4
- package/lib/p5.esm.js +3634 -2870
- package/lib/p5.esm.min.js +1 -1
- package/lib/p5.js +3634 -2870
- package/lib/p5.min.js +1 -1
- package/lib/p5.webgpu.esm.js +43 -15
- package/lib/p5.webgpu.js +43 -15
- package/lib/p5.webgpu.min.js +1 -1
- package/package.json +1 -1
- package/types/global.d.ts +805 -805
- package/types/p5.d.ts +415 -415
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { P as P2D, ac as WEBGL, B as BLEND, al as _DEFAULT_FILL, am as _DEFAULT_STROKE, w as ROUND, b as REMOVE, S as SUBTRACT, D as DARKEST, L as LIGHTEST, an as DIFFERENCE, M as MULTIPLY, E as EXCLUSION, a as SCREEN, R as REPLACE, ao as OVERLAY, ap as HARD_LIGHT, aq as SOFT_LIGHT, ar as DODGE, as as BURN, A as ADD, at as PIE, au as CHORD, q as TWO_PI, x as SQUARE, y as PROJECT, z as BEVEL, I as MITER, a9 as RIGHT, v as CENTER, av as LEFT, aw as BOTTOM, ax as BASELINE, ay as TOP, Q as OPEN, az as VERSION, a3 as constants } from './constants-
|
|
1
|
+
import { P as P2D, ac as WEBGL, B as BLEND, al as _DEFAULT_FILL, am as _DEFAULT_STROKE, w as ROUND, b as REMOVE, S as SUBTRACT, D as DARKEST, L as LIGHTEST, an as DIFFERENCE, M as MULTIPLY, E as EXCLUSION, a as SCREEN, R as REPLACE, ao as OVERLAY, ap as HARD_LIGHT, aq as SOFT_LIGHT, ar as DODGE, as as BURN, A as ADD, at as PIE, au as CHORD, q as TWO_PI, x as SQUARE, y as PROJECT, z as BEVEL, I as MITER, a9 as RIGHT, v as CENTER, av as LEFT, aw as BOTTOM, ax as BASELINE, ay as TOP, Q as OPEN, az as VERSION, a3 as constants } from './constants-D3ryGa0m.js';
|
|
2
2
|
import transform from './core/transform.js';
|
|
3
3
|
import structure from './core/structure.js';
|
|
4
4
|
import environment from './core/environment.js';
|
|
5
|
-
import { G as Graphics, k as rendering, n as graphics } from './rendering-
|
|
6
|
-
import { R as Renderer, I as Image, r as renderer } from './p5.Renderer-
|
|
5
|
+
import { G as Graphics, k as rendering, n as graphics } from './rendering-4Z2qdE_W.js';
|
|
6
|
+
import { R as Renderer, I as Image, r as renderer } from './p5.Renderer-C0e0XesC.js';
|
|
7
7
|
import { Element } from './dom/p5.Element.js';
|
|
8
8
|
import { MediaElement } from './dom/p5.MediaElement.js';
|
|
9
9
|
import { b as RGBHDR } from './creating_reading-C7hu6sg1.js';
|
|
@@ -1304,30 +1304,7 @@ class p5 {
|
|
|
1304
1304
|
constructor(sketch, node) {
|
|
1305
1305
|
// Apply addon defined decorations
|
|
1306
1306
|
if(p5.decorations.size > 0){
|
|
1307
|
-
|
|
1308
|
-
for(const member in p5.prototype) {
|
|
1309
|
-
// Member must be a function
|
|
1310
|
-
if (typeof p5.prototype[member] !== 'function') continue;
|
|
1311
|
-
|
|
1312
|
-
if (!patternArray.some(pattern => {
|
|
1313
|
-
if (typeof pattern === 'string') {
|
|
1314
|
-
return pattern === member;
|
|
1315
|
-
} else if (pattern instanceof RegExp) {
|
|
1316
|
-
return pattern.test(member);
|
|
1317
|
-
}
|
|
1318
|
-
})) continue;
|
|
1319
|
-
|
|
1320
|
-
p5.prototype[member] = decoration(p5.prototype[member], {
|
|
1321
|
-
kind: 'method',
|
|
1322
|
-
name: member,
|
|
1323
|
-
access: {},
|
|
1324
|
-
static: false,
|
|
1325
|
-
private: false,
|
|
1326
|
-
addInitializer(initializer){}
|
|
1327
|
-
});
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1307
|
+
decorateClass(p5, p5.decorations);
|
|
1331
1308
|
p5.decorations.clear();
|
|
1332
1309
|
}
|
|
1333
1310
|
|
|
@@ -1419,11 +1396,11 @@ class p5 {
|
|
|
1419
1396
|
}
|
|
1420
1397
|
|
|
1421
1398
|
get pixels(){
|
|
1422
|
-
return this._renderer
|
|
1399
|
+
return this._renderer?.pixels;
|
|
1423
1400
|
}
|
|
1424
1401
|
|
|
1425
1402
|
get drawingContext(){
|
|
1426
|
-
return this._renderer
|
|
1403
|
+
return this._renderer?.drawingContext;
|
|
1427
1404
|
}
|
|
1428
1405
|
|
|
1429
1406
|
static _registeredAddons = new Set();
|
|
@@ -1447,10 +1424,20 @@ class p5 {
|
|
|
1447
1424
|
}
|
|
1448
1425
|
|
|
1449
1426
|
static decorations = new Map();
|
|
1450
|
-
static
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1427
|
+
static registerDecorator(pattern, decoration){
|
|
1428
|
+
if(typeof pattern === 'string'){
|
|
1429
|
+
const patternStr = pattern;
|
|
1430
|
+
pattern = ({ path }) => patternStr === path;
|
|
1431
|
+
}else if(
|
|
1432
|
+
Array.isArray(pattern) &&
|
|
1433
|
+
pattern.every(value => typeof value === 'string')
|
|
1434
|
+
){
|
|
1435
|
+
const patternArray = pattern;
|
|
1436
|
+
pattern = ({ path }) => patternArray.includes(path);
|
|
1437
|
+
}else if(typeof pattern !== 'function'){
|
|
1438
|
+
throw new Error('Decorator matching pattern must be a function, a string, or an array of strings');
|
|
1439
|
+
}
|
|
1440
|
+
p5.decorations.set(pattern, decoration);
|
|
1454
1441
|
}
|
|
1455
1442
|
|
|
1456
1443
|
#customActions = {};
|
|
@@ -1691,6 +1678,11 @@ class p5 {
|
|
|
1691
1678
|
}
|
|
1692
1679
|
}
|
|
1693
1680
|
|
|
1681
|
+
// Attach constants to p5 prototype
|
|
1682
|
+
for (const k in constants) {
|
|
1683
|
+
p5.prototype[k] = constants[k];
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1694
1686
|
// Global helper function for binding properties to window in global mode
|
|
1695
1687
|
function createBindGlobal(instance) {
|
|
1696
1688
|
return function bindGlobal(property) {
|
|
@@ -1781,9 +1773,107 @@ function createBindGlobal(instance) {
|
|
|
1781
1773
|
};
|
|
1782
1774
|
}
|
|
1783
1775
|
|
|
1784
|
-
//
|
|
1785
|
-
|
|
1786
|
-
|
|
1776
|
+
// Generic function to decorate classes
|
|
1777
|
+
function decorateClass(Target, decorations, path){
|
|
1778
|
+
path ??= Target.name;
|
|
1779
|
+
// Static properties
|
|
1780
|
+
for(const key in Target){
|
|
1781
|
+
if(!key.startsWith('_')){
|
|
1782
|
+
for (const [pattern, decorator] of decorations) {
|
|
1783
|
+
if(pattern({ path: `${path}.${key}` })){
|
|
1784
|
+
// Check if method or accessor
|
|
1785
|
+
if(typeof Target[key] === 'function'){
|
|
1786
|
+
const result = decorator(Target[key], {
|
|
1787
|
+
kind: 'method',
|
|
1788
|
+
name: key,
|
|
1789
|
+
static: true
|
|
1790
|
+
});
|
|
1791
|
+
if(result){
|
|
1792
|
+
Object.defineProperty(Target, key, {
|
|
1793
|
+
enumerable: true,
|
|
1794
|
+
writable: true,
|
|
1795
|
+
value: result
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1798
|
+
}else {
|
|
1799
|
+
const result = decorator(undefined, {
|
|
1800
|
+
kind: 'field',
|
|
1801
|
+
name: key,
|
|
1802
|
+
static: true
|
|
1803
|
+
});
|
|
1804
|
+
if(result && typeof result === 'function'){
|
|
1805
|
+
Target[key] = result(Target[key]);
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
if(typeof Target[key] === 'function' && Target[key].prototype){
|
|
1812
|
+
decorateClass(Target[key], decorations, `${path}.${key}`);
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
// Member properties
|
|
1818
|
+
for(const member of Object.getOwnPropertyNames(Target.prototype)){
|
|
1819
|
+
if(member !== 'constructor' && !member.startsWith('_')){
|
|
1820
|
+
for (const [pattern, decorator] of decorations) {
|
|
1821
|
+
if(pattern({ path: `${path}.prototype.${member}` })){
|
|
1822
|
+
// Check if method or accessor
|
|
1823
|
+
if(typeof Target.prototype[member] === 'function'){
|
|
1824
|
+
const result = decorator(Target.prototype[member], {
|
|
1825
|
+
kind: 'method',
|
|
1826
|
+
name: member,
|
|
1827
|
+
static: false
|
|
1828
|
+
});
|
|
1829
|
+
if(result) {
|
|
1830
|
+
Object.defineProperty(Target.prototype, member, {
|
|
1831
|
+
enumerable: true,
|
|
1832
|
+
writable: true,
|
|
1833
|
+
value: result
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1836
|
+
}else {
|
|
1837
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
1838
|
+
Target.prototype,
|
|
1839
|
+
member
|
|
1840
|
+
);
|
|
1841
|
+
if(descriptor.hasOwnProperty('value')){
|
|
1842
|
+
const result = decorator(undefined, {
|
|
1843
|
+
kind: 'field',
|
|
1844
|
+
name: member,
|
|
1845
|
+
static: false
|
|
1846
|
+
});
|
|
1847
|
+
Object.defineProperty(Target.prototype, member, {
|
|
1848
|
+
enumerable: true,
|
|
1849
|
+
writable: true,
|
|
1850
|
+
value: result && typeof result === 'function' ?
|
|
1851
|
+
result(Target.prototype[member]) :
|
|
1852
|
+
Target.prototype[member]
|
|
1853
|
+
});
|
|
1854
|
+
}else {
|
|
1855
|
+
const { get, set } = descriptor;
|
|
1856
|
+
const getterResult = decorator(get, {
|
|
1857
|
+
kind: 'getter',
|
|
1858
|
+
name: member,
|
|
1859
|
+
static: false
|
|
1860
|
+
});
|
|
1861
|
+
const setterResult = decorator(set, {
|
|
1862
|
+
kind: 'setter',
|
|
1863
|
+
name: member,
|
|
1864
|
+
static: false
|
|
1865
|
+
});
|
|
1866
|
+
Object.defineProperty(Target.prototype, member, {
|
|
1867
|
+
enumerable: true,
|
|
1868
|
+
get: getterResult ?? get,
|
|
1869
|
+
set: setterResult ?? set
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1787
1877
|
}
|
|
1788
1878
|
|
|
1789
1879
|
p5.registerAddon(transform);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import nj from '@d4c/numjs/build/module/numjs.min.js';
|
|
2
2
|
import { Vector } from '../p5.Vector.js';
|
|
3
3
|
import { MatrixInterface } from './MatrixInterface.js';
|
|
4
|
-
import '../../constants-
|
|
4
|
+
import '../../constants-D3ryGa0m.js';
|
|
5
5
|
|
|
6
6
|
let isMatrixArray = x => Array.isArray(x);
|
|
7
7
|
if (typeof Float32Array !== 'undefined') {
|
package/dist/math/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import random from './random.js';
|
|
|
4
4
|
import trigonometry from './trigonometry.js';
|
|
5
5
|
import math$1 from './math.js';
|
|
6
6
|
import vector from './p5.Vector.js';
|
|
7
|
-
import '../constants-
|
|
7
|
+
import '../constants-D3ryGa0m.js';
|
|
8
8
|
|
|
9
9
|
function math(p5){
|
|
10
10
|
p5.registerAddon(calculation);
|
package/dist/math/p5.Matrix.js
CHANGED
package/dist/math/p5.Vector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as Color } from './creating_reading-C7hu6sg1.js';
|
|
2
|
-
import { a2 as NORMAL, aA as WORD, ax as BASELINE, av as LEFT, v as CENTER, p as CORNER, J as INCLUDE } from './constants-
|
|
2
|
+
import { a2 as NORMAL, aA as WORD, ax as BASELINE, av as LEFT, v as CENTER, p as CORNER, J as INCLUDE } from './constants-D3ryGa0m.js';
|
|
3
3
|
import Filters from './image/filters.js';
|
|
4
4
|
import { Vector } from './math/p5.Vector.js';
|
|
5
5
|
import { Shape } from './shape/custom_shapes.js';
|
|
@@ -2317,7 +2317,14 @@ class Renderer {
|
|
|
2317
2317
|
this._pInst = pInst;
|
|
2318
2318
|
this._isMainCanvas = isMainCanvas;
|
|
2319
2319
|
this.pixels = [];
|
|
2320
|
-
|
|
2320
|
+
|
|
2321
|
+
if (isMainCanvas) {
|
|
2322
|
+
this._pixelDensity = Math.ceil(window.devicePixelRatio) || 1;
|
|
2323
|
+
} else {
|
|
2324
|
+
|
|
2325
|
+
const parentDensity = pInst._pInst?._renderer?._pixelDensity;
|
|
2326
|
+
this._pixelDensity = parentDensity || Math.ceil(window.devicePixelRatio) || 1;
|
|
2327
|
+
}
|
|
2321
2328
|
|
|
2322
2329
|
this.width = w;
|
|
2323
2330
|
this.height = h;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { p as CORNER, t as CORNERS, v as CENTER, aB as COVER, aC as CONTAIN, a9 as RIGHT, aw as BOTTOM, B as BLEND, aD as FILL, ad as IMAGE, C as CLAMP, w as ROUND, Y as LINES, X as POINTS, c as TRIANGLES, ab as BLUR, D as DARKEST, L as LIGHTEST, A as ADD, S as SUBTRACT, a as SCREEN, E as EXCLUSION, R as REPLACE, M as MULTIPLY, b as REMOVE, as as BURN, ao as OVERLAY, ap as HARD_LIGHT, aq as SOFT_LIGHT, ar as DODGE, d as UNSIGNED_INT, U as UNSIGNED_BYTE, av as LEFT, ax as BASELINE, ay as TOP, aE as SIMPLE, aF as FULL, q as TWO_PI, Q as OPEN, a2 as NORMAL, V as CLOSE, at as PIE, au as CHORD, h as TEXTURE, P as P2D, g as LINEAR, aa as WEBGL2, N as NEAREST, aG as LINEAR_MIPMAP, f as REPEAT, e as MIRROR, F as FLOAT, ac as WEBGL, H as HALF_FLOAT } from './constants-
|
|
1
|
+
import { p as CORNER, t as CORNERS, v as CENTER, aB as COVER, aC as CONTAIN, a9 as RIGHT, aw as BOTTOM, B as BLEND, aD as FILL, ad as IMAGE, C as CLAMP, w as ROUND, Y as LINES, X as POINTS, c as TRIANGLES, ab as BLUR, D as DARKEST, L as LIGHTEST, A as ADD, S as SUBTRACT, a as SCREEN, E as EXCLUSION, R as REPLACE, M as MULTIPLY, b as REMOVE, as as BURN, ao as OVERLAY, ap as HARD_LIGHT, aq as SOFT_LIGHT, ar as DODGE, d as UNSIGNED_INT, U as UNSIGNED_BYTE, av as LEFT, ax as BASELINE, ay as TOP, aE as SIMPLE, aF as FULL, q as TWO_PI, Q as OPEN, a2 as NORMAL, V as CLOSE, at as PIE, au as CHORD, h as TEXTURE, P as P2D, g as LINEAR, aa as WEBGL2, N as NEAREST, aG as LINEAR_MIPMAP, f as REPEAT, e as MIRROR, F as FLOAT, ac as WEBGL, H as HALF_FLOAT } from './constants-D3ryGa0m.js';
|
|
2
2
|
import { C as Color, c as creatingReading, h as RGBA, R as RGB } from './creating_reading-C7hu6sg1.js';
|
|
3
3
|
import { Element } from './dom/p5.Element.js';
|
|
4
|
-
import { R as Renderer, I as Image } from './p5.Renderer-
|
|
4
|
+
import { R as Renderer, I as Image } from './p5.Renderer-C0e0XesC.js';
|
|
5
5
|
import { MediaElement } from './dom/p5.MediaElement.js';
|
|
6
6
|
import primitives from './shape/2d_primitives.js';
|
|
7
7
|
import attributes from './shape/attributes.js';
|
|
@@ -1008,8 +1008,11 @@ function files(p5, fn){
|
|
|
1008
1008
|
|
|
1009
1009
|
try{
|
|
1010
1010
|
const { data } = await request(path, 'json');
|
|
1011
|
-
|
|
1012
|
-
|
|
1011
|
+
const cb = () => {
|
|
1012
|
+
if (successCallback) return successCallback(data);
|
|
1013
|
+
return data;
|
|
1014
|
+
};
|
|
1015
|
+
return this._internal ? this._internal(cb) : cb();
|
|
1013
1016
|
} catch(err) {
|
|
1014
1017
|
p5._friendlyFileLoadError(5, path);
|
|
1015
1018
|
if(errorCallback) {
|
|
@@ -1144,10 +1147,12 @@ function files(p5, fn){
|
|
|
1144
1147
|
|
|
1145
1148
|
try{
|
|
1146
1149
|
let { data } = await request(path, 'text');
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1150
|
+
const cb = () => {
|
|
1151
|
+
data = data.split(/\r?\n/);
|
|
1152
|
+
if (successCallback) return successCallback(data);
|
|
1153
|
+
return data;
|
|
1154
|
+
};
|
|
1155
|
+
return this._internal ? this._internal(cb) : cb();
|
|
1151
1156
|
} catch(err) {
|
|
1152
1157
|
p5._friendlyFileLoadError(3, path);
|
|
1153
1158
|
if(errorCallback) {
|
|
@@ -1231,28 +1236,30 @@ function files(p5, fn){
|
|
|
1231
1236
|
|
|
1232
1237
|
try{
|
|
1233
1238
|
let { data } = await request(path, 'text');
|
|
1239
|
+
const cb = () => {
|
|
1240
|
+
let ret = new p5.Table();
|
|
1241
|
+
data = parse(data, {
|
|
1242
|
+
separator
|
|
1243
|
+
});
|
|
1234
1244
|
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
if(header){
|
|
1241
|
-
ret.columns = data.shift();
|
|
1242
|
-
}else {
|
|
1243
|
-
ret.columns = Array(data[0].length).fill(null);
|
|
1244
|
-
}
|
|
1245
|
+
if(header){
|
|
1246
|
+
ret.columns = data.shift();
|
|
1247
|
+
}else {
|
|
1248
|
+
ret.columns = Array(data[0].length).fill(null);
|
|
1249
|
+
}
|
|
1245
1250
|
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1251
|
+
data.forEach(line => {
|
|
1252
|
+
const row = new p5.TableRow(line);
|
|
1253
|
+
ret.addRow(row);
|
|
1254
|
+
});
|
|
1250
1255
|
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
+
if (successCallback) {
|
|
1257
|
+
return successCallback(ret);
|
|
1258
|
+
} else {
|
|
1259
|
+
return ret;
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
return this._internal ? this._internal(cb) : cb();
|
|
1256
1263
|
} catch(err) {
|
|
1257
1264
|
p5._friendlyFileLoadError(2, path);
|
|
1258
1265
|
if(errorCallback) {
|
|
@@ -1416,11 +1423,13 @@ function files(p5, fn){
|
|
|
1416
1423
|
const parser = new DOMParser();
|
|
1417
1424
|
|
|
1418
1425
|
let { data } = await request(path, 'text');
|
|
1419
|
-
const
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1426
|
+
const cb = () => {
|
|
1427
|
+
const parsedDOM = parser.parseFromString(data, 'application/xml');
|
|
1428
|
+
data = new p5.XML(parsedDOM);
|
|
1429
|
+
if (successCallback) return successCallback(data);
|
|
1430
|
+
return data;
|
|
1431
|
+
};
|
|
1432
|
+
return this._internal ? this._internal(cb) : cb();
|
|
1424
1433
|
} catch(err) {
|
|
1425
1434
|
p5._friendlyFileLoadError(1, path);
|
|
1426
1435
|
if(errorCallback) {
|
|
@@ -1464,9 +1473,12 @@ function files(p5, fn){
|
|
|
1464
1473
|
fn.loadBytes = async function (path, successCallback, errorCallback) {
|
|
1465
1474
|
try{
|
|
1466
1475
|
let { data } = await request(path, 'arrayBuffer');
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1476
|
+
const cb = () => {
|
|
1477
|
+
data = new Uint8Array(data);
|
|
1478
|
+
if (successCallback) return successCallback(data);
|
|
1479
|
+
return data;
|
|
1480
|
+
};
|
|
1481
|
+
return this._internal ? this._internal(cb) : cb();
|
|
1470
1482
|
} catch(err) {
|
|
1471
1483
|
p5._friendlyFileLoadError(6, path);
|
|
1472
1484
|
if(errorCallback) {
|
|
@@ -1519,8 +1531,11 @@ function files(p5, fn){
|
|
|
1519
1531
|
fn.loadBlob = async function(path, successCallback, errorCallback) {
|
|
1520
1532
|
try{
|
|
1521
1533
|
const { data } = await request(path, 'blob');
|
|
1522
|
-
|
|
1523
|
-
|
|
1534
|
+
const cb = () => {
|
|
1535
|
+
if (successCallback) return successCallback(data);
|
|
1536
|
+
return data;
|
|
1537
|
+
};
|
|
1538
|
+
return this._internal ? this._internal(cb) : cb();
|
|
1524
1539
|
} catch(err) {
|
|
1525
1540
|
if(errorCallback) {
|
|
1526
1541
|
return errorCallback(err);
|
|
@@ -2969,13 +2984,15 @@ function loadingDisplaying(p5, fn){
|
|
|
2969
2984
|
pImg.drawingContext.drawImage(img, 0, 0);
|
|
2970
2985
|
}
|
|
2971
2986
|
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2987
|
+
const cb = () => {
|
|
2988
|
+
pImg.modified = true;
|
|
2989
|
+
if(successCallback){
|
|
2990
|
+
return successCallback(pImg);
|
|
2991
|
+
}else {
|
|
2992
|
+
return pImg;
|
|
2993
|
+
}
|
|
2994
|
+
};
|
|
2995
|
+
return this._internal ? this._internal(cb) : cb();
|
|
2979
2996
|
|
|
2980
2997
|
} catch(err) {
|
|
2981
2998
|
p5._friendlyFileLoadError(0, path);
|
|
@@ -6017,6 +6034,17 @@ class Camera {
|
|
|
6017
6034
|
|
|
6018
6035
|
_cam.cameraType = this.cameraType;
|
|
6019
6036
|
|
|
6037
|
+
_cam.defaultAspectRatio = this.defaultAspectRatio;
|
|
6038
|
+
_cam.defaultEyeX = this.defaultEyeX;
|
|
6039
|
+
_cam.defaultEyeY = this.defaultEyeY;
|
|
6040
|
+
_cam.defaultEyeZ = this.defaultEyeZ;
|
|
6041
|
+
_cam.defaultCameraFOV = this.defaultCameraFOV;
|
|
6042
|
+
_cam.defaultCenterX = this.defaultCenterX;
|
|
6043
|
+
_cam.defaultCenterY = this.defaultCenterY;
|
|
6044
|
+
_cam.defaultCenterZ = this.defaultCenterZ;
|
|
6045
|
+
_cam.defaultCameraNear = this.defaultCameraNear;
|
|
6046
|
+
_cam.defaultCameraFar = this.defaultCameraFar;
|
|
6047
|
+
|
|
6020
6048
|
return _cam;
|
|
6021
6049
|
}
|
|
6022
6050
|
|
|
@@ -14944,11 +14972,11 @@ function material(p5, fn) {
|
|
|
14944
14972
|
// Test if we've loaded GLSL or not by checking for the existence of `void main`
|
|
14945
14973
|
let loadedShader;
|
|
14946
14974
|
if (/void\s+main/.exec(fragString)) {
|
|
14947
|
-
loadedShader = this.createFilterShader(fragString, true);
|
|
14975
|
+
loadedShader = this._internal(() => this.createFilterShader(fragString, true));
|
|
14948
14976
|
} else {
|
|
14949
|
-
loadedShader = withGlobalStrands(this, () =>
|
|
14977
|
+
loadedShader = this._internal(() => withGlobalStrands(this, () =>
|
|
14950
14978
|
this.baseFilterShader().modify(new Function(fragString)),
|
|
14951
|
-
);
|
|
14979
|
+
));
|
|
14952
14980
|
}
|
|
14953
14981
|
|
|
14954
14982
|
if (successCallback) {
|
|
@@ -16055,7 +16083,7 @@ function material(p5, fn) {
|
|
|
16055
16083
|
fn.loadMaterialShader = async function (url, onSuccess, onFail) {
|
|
16056
16084
|
try {
|
|
16057
16085
|
const cb = await urlToStrandsCallback(url);
|
|
16058
|
-
let shader = withGlobalStrands(this, () => this.buildMaterialShader(cb));
|
|
16086
|
+
let shader = this._internal(() => withGlobalStrands(this, () => this.buildMaterialShader(cb)));
|
|
16059
16087
|
if (onSuccess) {
|
|
16060
16088
|
shader = onSuccess(shader) || shader;
|
|
16061
16089
|
}
|
|
@@ -16274,9 +16302,9 @@ function material(p5, fn) {
|
|
|
16274
16302
|
fn.loadNormalShader = async function (url, onSuccess, onFail) {
|
|
16275
16303
|
try {
|
|
16276
16304
|
const cb = await urlToStrandsCallback(url);
|
|
16277
|
-
let shader = this.withGlobalStrands(this, () =>
|
|
16305
|
+
let shader = this._internal(() => this.withGlobalStrands(this, () =>
|
|
16278
16306
|
this.buildNormalShader(cb),
|
|
16279
|
-
);
|
|
16307
|
+
));
|
|
16280
16308
|
if (onSuccess) {
|
|
16281
16309
|
shader = onSuccess(shader) || shader;
|
|
16282
16310
|
}
|
|
@@ -16440,7 +16468,7 @@ function material(p5, fn) {
|
|
|
16440
16468
|
fn.loadColorShader = async function (url, onSuccess, onFail) {
|
|
16441
16469
|
try {
|
|
16442
16470
|
const cb = await urlToStrandsCallback(url);
|
|
16443
|
-
let shader = withGlobalStrands(this, () => this.buildColorShader(cb));
|
|
16471
|
+
let shader = this._internal(() => withGlobalStrands(this, () => this.buildColorShader(cb)));
|
|
16444
16472
|
if (onSuccess) {
|
|
16445
16473
|
shader = onSuccess(shader) || shader;
|
|
16446
16474
|
}
|
|
@@ -16701,7 +16729,7 @@ function material(p5, fn) {
|
|
|
16701
16729
|
fn.loadStrokeShader = async function (url, onSuccess, onFail) {
|
|
16702
16730
|
try {
|
|
16703
16731
|
const cb = await urlToStrandsCallback(url);
|
|
16704
|
-
let shader = withGlobalStrands(this, () => this.buildStrokeShader(cb));
|
|
16732
|
+
let shader = this._internal(() => withGlobalStrands(this, () => this.buildStrokeShader(cb)));
|
|
16705
16733
|
if (onSuccess) {
|
|
16706
16734
|
shader = onSuccess(shader) || shader;
|
|
16707
16735
|
}
|
|
@@ -18997,11 +19025,18 @@ class Texture {
|
|
|
18997
19025
|
this.isSrcMediaElement ||
|
|
18998
19026
|
this.isSrcHTMLElement
|
|
18999
19027
|
) {
|
|
19000
|
-
//
|
|
19001
|
-
|
|
19028
|
+
// createCapture elements that are flipped need
|
|
19029
|
+
// to go through a canvas
|
|
19030
|
+
if (this.isSrcMediaElement && this.src.flipped) {
|
|
19002
19031
|
this.src._ensureCanvas();
|
|
19032
|
+
textureData = this.src.canvas;
|
|
19033
|
+
} else {
|
|
19034
|
+
// if param is a video HTML element
|
|
19035
|
+
if (this.src._checkIfTextureNeedsUpdate) {
|
|
19036
|
+
this.src._checkIfTextureNeedsUpdate();
|
|
19037
|
+
}
|
|
19038
|
+
textureData = this.src.elt;
|
|
19003
19039
|
}
|
|
19004
|
-
textureData = this.src.elt;
|
|
19005
19040
|
} else if (this.isSrcP5Graphics || this.isSrcP5Renderer) {
|
|
19006
19041
|
textureData = this.src.canvas;
|
|
19007
19042
|
} else if (this.isImageData) {
|
package/dist/shape/attributes.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as CORNER, t as CORNERS, u as RADIUS, v as CENTER, w as ROUND, x as SQUARE, y as PROJECT, z as BEVEL, I as MITER } from '../constants-
|
|
1
|
+
import { p as CORNER, t as CORNERS, u as RADIUS, v as CENTER, w as ROUND, x as SQUARE, y as PROJECT, z as BEVEL, I as MITER } from '../constants-D3ryGa0m.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @module Shape
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as Color } from '../creating_reading-C7hu6sg1.js';
|
|
2
2
|
import { Vector } from '../math/p5.Vector.js';
|
|
3
|
-
import { J as INCLUDE, K as PATH, O as EMPTY_PATH, Q as OPEN, V as CLOSE, X as POINTS, Y as LINES, c as TRIANGLES, Z as QUADS, _ as TRIANGLE_FAN, T as TRIANGLE_STRIP, $ as QUAD_STRIP, a0 as EXCLUDE, a1 as JOIN } from '../constants-
|
|
3
|
+
import { J as INCLUDE, K as PATH, O as EMPTY_PATH, Q as OPEN, V as CLOSE, X as POINTS, Y as LINES, c as TRIANGLES, Z as QUADS, _ as TRIANGLE_FAN, T as TRIANGLE_STRIP, $ as QUAD_STRIP, a0 as EXCLUDE, a1 as JOIN } from '../constants-D3ryGa0m.js';
|
|
4
4
|
import 'colorjs.io/fn';
|
|
5
5
|
import '../color/color_spaces/hsb.js';
|
|
6
6
|
|
package/dist/shape/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import attributes from './attributes.js';
|
|
|
3
3
|
import curves from './curves.js';
|
|
4
4
|
import vertex from './vertex.js';
|
|
5
5
|
import customShapes from './custom_shapes.js';
|
|
6
|
-
import '../constants-
|
|
6
|
+
import '../constants-D3ryGa0m.js';
|
|
7
7
|
import '../core/helpers.js';
|
|
8
8
|
import '../creating_reading-C7hu6sg1.js';
|
|
9
9
|
import 'colorjs.io/fn';
|
|
@@ -2,5 +2,5 @@ import './ir_dag.js';
|
|
|
2
2
|
import './ir_cfg.js';
|
|
3
3
|
import './strands_FES.js';
|
|
4
4
|
import './ir_types.js';
|
|
5
|
-
export {
|
|
5
|
+
export { b as binaryOpNode, h as castToFloat, g as constructTypeFromIDs, f as functionCallNode, m as memberAccessNode, p as primitiveConstructorNode, e as scalarLiteralNode, s as statementNode, d as structConstructorNode, a as structInstanceNode, i as swizzleNode, j as swizzleTrap, u as unaryOpNode, v as variableNode } from '../ir_builders-DMfaOLIL.js';
|
|
6
6
|
import './strands_builtins.js';
|
package/dist/strands/ir_dag.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BasePriority, NodeTypeRequiredFields, NodeTypeToName } from './ir_types.js';
|
|
1
|
+
import { BasePriority, NodeTypeRequiredFields, NodeTypeToName, BaseType } from './ir_types.js';
|
|
2
2
|
import { internalError } from './strands_FES.js';
|
|
3
3
|
|
|
4
4
|
/////////////////////////////////
|
|
@@ -81,6 +81,36 @@ function extractNodeTypeInfo(dag, nodeID) {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
// Propagate a known type to an ASSIGN_ON_USE node and all its ASSIGN_ON_USE dependencies
|
|
85
|
+
function propagateTypeToAssignOnUse(dag, nodeId, baseType, dimension, visited = new Set()) {
|
|
86
|
+
// Avoid infinite loops
|
|
87
|
+
if (visited.has(nodeId)) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
visited.add(nodeId);
|
|
91
|
+
|
|
92
|
+
const node = getNodeDataFromID(dag, nodeId);
|
|
93
|
+
|
|
94
|
+
// Only update if this node is ASSIGN_ON_USE
|
|
95
|
+
if (node.baseType !== BaseType.ASSIGN_ON_USE) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Update this node's type
|
|
100
|
+
dag.baseTypes[nodeId] = baseType;
|
|
101
|
+
dag.dimensions[nodeId] = dimension;
|
|
102
|
+
|
|
103
|
+
// Recursively propagate to any ASSIGN_ON_USE dependencies
|
|
104
|
+
if (node.dependsOn && node.dependsOn.length > 0) {
|
|
105
|
+
for (const depId of node.dependsOn) {
|
|
106
|
+
const dep = getNodeDataFromID(dag, depId);
|
|
107
|
+
if (dep.baseType === BaseType.ASSIGN_ON_USE) {
|
|
108
|
+
propagateTypeToAssignOnUse(dag, depId, baseType, dimension, visited);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
84
114
|
/////////////////////////////////
|
|
85
115
|
// Private functions
|
|
86
116
|
/////////////////////////////////
|
|
@@ -127,4 +157,4 @@ function validateNode(node){
|
|
|
127
157
|
}
|
|
128
158
|
}
|
|
129
159
|
|
|
130
|
-
export { createDirectedAcyclicGraph, createNodeData, extractNodeTypeInfo, getNodeDataFromID, getOrCreateNode };
|
|
160
|
+
export { createDirectedAcyclicGraph, createNodeData, extractNodeTypeInfo, getNodeDataFromID, getOrCreateNode, propagateTypeToAssignOnUse };
|