p5 2.0.1 → 2.0.3
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/describe.js +10 -0
- package/dist/accessibility/index.js +5 -5
- package/dist/accessibility/outputs.js +21 -0
- package/dist/app.js +5 -5
- package/dist/color/color_conversion.js +5 -5
- package/dist/color/creating_reading.js +1 -1
- package/dist/color/index.js +2 -2
- package/dist/color/p5.Color.js +1 -1
- package/dist/color/setting.js +2 -2
- package/dist/{constants-C-g_eAdC.js → constants-BRcElHU3.js} +19 -3
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +6 -5
- package/dist/core/friendly_errors/fes_core.js +1 -1
- package/dist/core/friendly_errors/index.js +1 -1
- package/dist/core/friendly_errors/param_validator.js +46 -93
- package/dist/core/friendly_errors/sketch_reader.js +5 -5
- package/dist/core/friendly_errors/sketch_verifier.js +1 -1
- package/dist/core/friendly_errors/validate_params.js +5 -5
- package/dist/core/helpers.js +1 -1
- package/dist/core/init.js +5 -5
- package/dist/core/legacy.js +5 -5
- package/dist/core/main.js +5 -5
- package/dist/core/p5.Graphics.js +4 -4
- package/dist/core/p5.Renderer.js +3 -3
- package/dist/core/p5.Renderer2D.js +5 -5
- package/dist/core/rendering.js +4 -4
- package/dist/{creating_reading-D4AAKRbx.js → creating_reading-Cr8L2Jnm.js} +2 -2
- package/dist/dom/dom.js +10 -10
- package/dist/dom/index.js +2 -2
- package/dist/dom/p5.Element.js +2 -2
- package/dist/dom/p5.MediaElement.js +2 -2
- package/dist/events/acceleration.js +24 -24
- package/dist/events/keyboard.js +11 -6
- package/dist/image/const.js +1 -1
- package/dist/image/filterRenderer2D.js +4 -4
- package/dist/image/image.js +4 -4
- package/dist/image/index.js +4 -4
- package/dist/image/loading_displaying.js +4 -4
- package/dist/image/p5.Image.js +3 -3
- package/dist/image/pixels.js +1 -0
- package/dist/io/files.js +4 -4
- package/dist/io/index.js +4 -4
- package/dist/io/p5.TableRow.js +2 -2
- package/dist/{main-s72KWcUy.js → main-BKN5yFoS.js} +12 -9
- 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/math.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-CwAYZOC2.js → p5.Renderer-R23xoC7s.js} +5 -5
- package/dist/{rendering--aAe5aq3.js → rendering-CvUVN-Vb.js} +101 -66
- package/dist/shape/2d_primitives.js +1 -1
- package/dist/shape/attributes.js +1 -1
- package/dist/shape/custom_shapes.js +2 -2
- package/dist/shape/index.js +2 -2
- package/dist/type/index.js +3 -3
- package/dist/type/p5.Font.js +3 -5
- package/dist/type/textCore.js +4 -4
- package/dist/webgl/3d_primitives.js +4 -4
- package/dist/webgl/GeometryBuilder.js +1 -1
- package/dist/webgl/ShapeBuilder.js +1 -1
- package/dist/webgl/index.js +4 -4
- package/dist/webgl/interaction.js +1 -1
- package/dist/webgl/light.js +4 -4
- package/dist/webgl/loading.js +5 -4
- package/dist/webgl/material.js +4 -4
- package/dist/webgl/p5.Camera.js +4 -4
- package/dist/webgl/p5.Framebuffer.js +4 -4
- 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.Shader.js +4 -4
- package/dist/webgl/p5.Texture.js +4 -4
- package/dist/webgl/text.js +32 -34
- package/lib/p5.esm.js +289 -247
- package/lib/p5.js +289 -247
- package/lib/p5.min.js +1 -1
- package/package.json +1 -2
- package/types/accessibility/color_namer.d.ts +8 -0
- package/types/accessibility/describe.d.ts +184 -0
- package/types/accessibility/gridOutput.d.ts +8 -0
- package/types/accessibility/outputs.d.ts +235 -0
- package/types/accessibility/textOutput.d.ts +8 -0
- package/types/color/color_conversion.d.ts +47 -0
- package/types/color/creating_reading.d.ts +1348 -0
- package/types/color/p5.Color.d.ts +1070 -0
- package/types/color/setting.d.ts +2085 -0
- package/types/core/constants.d.ts +341 -0
- package/types/core/environment.d.ts +668 -0
- package/types/core/friendly_errors/fes_core.d.ts +8 -0
- package/types/core/friendly_errors/file_errors.d.ts +8 -0
- package/types/core/friendly_errors/param_validator.d.ts +30 -0
- package/types/core/friendly_errors/sketch_reader.d.ts +8 -0
- package/types/core/friendly_errors/stacktrace.d.ts +11 -0
- package/types/core/friendly_errors/validate_params.d.ts +8 -0
- package/types/core/helpers.d.ts +8 -0
- package/types/core/legacy.d.ts +8 -0
- package/types/core/main.d.ts +5999 -0
- package/types/core/p5.Graphics.d.ts +484 -0
- package/types/core/p5.Renderer.d.ts +14 -0
- package/types/core/reference.d.ts +8 -0
- package/types/core/rendering.d.ts +481 -0
- package/types/core/structure.d.ts +492 -0
- package/types/core/transform.d.ts +1638 -0
- package/types/data/local_storage.d.ts +323 -0
- package/types/dom/dom.d.ts +1295 -0
- package/types/dom/p5.Element.d.ts +2011 -0
- package/types/dom/p5.File.d.ts +13 -0
- package/types/dom/p5.MediaElement.d.ts +1249 -0
- package/types/events/acceleration.d.ts +193 -0
- package/types/events/keyboard.d.ts +501 -0
- package/types/events/pointer.d.ts +782 -0
- package/types/global.d.ts +5544 -0
- package/types/image/filterRenderer2D.d.ts +54 -0
- package/types/image/image.d.ts +326 -0
- package/types/image/loading_displaying.d.ts +580 -0
- package/types/image/p5.Image.d.ts +5882 -0
- package/types/image/pixels.d.ts +832 -0
- package/types/io/files.d.ts +1447 -0
- package/types/io/p5.Table.d.ts +1247 -0
- package/types/io/p5.TableRow.d.ts +343 -0
- package/types/io/p5.XML.d.ts +1188 -0
- package/types/math/Matrices/Matrix.d.ts +1029 -0
- package/types/math/Matrices/MatrixNumjs.d.ts +8 -0
- package/types/math/calculation.d.ts +923 -0
- package/types/math/math.d.ts +90 -0
- package/types/math/noise.d.ts +311 -0
- package/types/math/p5.Matrix.d.ts +8 -0
- package/types/math/p5.Vector.d.ts +3416 -0
- package/types/math/random.d.ts +267 -0
- package/types/math/trigonometry.d.ts +663 -0
- package/types/p5.d.ts +6666 -0
- package/types/shape/2d_primitives.d.ts +1033 -0
- package/types/shape/attributes.d.ts +466 -0
- package/types/shape/curves.d.ts +740 -0
- package/types/shape/custom_shapes.d.ts +888 -0
- package/types/shape/vertex.d.ts +1141 -0
- package/types/type/p5.Font.d.ts +575 -0
- package/types/type/textCore.d.ts +1198 -0
- package/types/utilities/conversion.d.ts +894 -0
- package/types/utilities/time_date.d.ts +295 -0
- package/types/utilities/utility_functions.d.ts +587 -0
- package/types/webgl/3d_primitives.d.ts +1432 -0
- package/types/webgl/ShaderGenerator.d.ts +8 -0
- package/types/webgl/interaction.d.ts +371 -0
- package/types/webgl/light.d.ts +1184 -0
- package/types/webgl/loading.d.ts +482 -0
- package/types/webgl/material.d.ts +2656 -0
- package/types/webgl/p5.Camera.d.ts +3023 -0
- package/types/webgl/p5.DataArray.d.ts +61 -0
- package/types/webgl/p5.Framebuffer.d.ts +760 -0
- package/types/webgl/p5.Geometry.d.ts +1191 -0
- package/types/webgl/p5.Quat.d.ts +45 -0
- package/types/webgl/p5.RendererGL.d.ts +234 -0
- package/types/webgl/p5.Shader.d.ts +660 -0
- package/types/webgl/p5.Texture.d.ts +61 -0
- package/types/webgl/text.d.ts +74 -0
package/dist/webgl/material.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import '../constants-
|
|
2
|
-
export { m as default } from '../rendering
|
|
3
|
-
import '../creating_reading-
|
|
1
|
+
import '../constants-BRcElHU3.js';
|
|
2
|
+
export { m as default } from '../rendering-CvUVN-Vb.js';
|
|
3
|
+
import '../creating_reading-Cr8L2Jnm.js';
|
|
4
4
|
import '../dom/p5.Element.js';
|
|
5
5
|
import '../dom/p5.File.js';
|
|
6
6
|
import '../io/p5.XML.js';
|
|
7
7
|
import 'colorjs.io/fn';
|
|
8
8
|
import '../color/color_spaces/hsb.js';
|
|
9
|
-
import '../p5.Renderer-
|
|
9
|
+
import '../p5.Renderer-R23xoC7s.js';
|
|
10
10
|
import '../image/filters.js';
|
|
11
11
|
import '../math/p5.Vector.js';
|
|
12
12
|
import '../shape/custom_shapes.js';
|
package/dist/webgl/p5.Camera.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import '../math/p5.Matrix.js';
|
|
2
2
|
import '../math/p5.Vector.js';
|
|
3
3
|
import './p5.Quat.js';
|
|
4
|
-
export { C as Camera, c as default } from '../rendering
|
|
4
|
+
export { C as Camera, c as default } from '../rendering-CvUVN-Vb.js';
|
|
5
5
|
import '../math/Matrices/Matrix.js';
|
|
6
|
-
import '../constants-
|
|
6
|
+
import '../constants-BRcElHU3.js';
|
|
7
7
|
import '../math/Matrices/MatrixInterface.js';
|
|
8
|
-
import '../creating_reading-
|
|
8
|
+
import '../creating_reading-Cr8L2Jnm.js';
|
|
9
9
|
import 'colorjs.io/fn';
|
|
10
10
|
import '../color/color_spaces/hsb.js';
|
|
11
11
|
import '../dom/p5.Element.js';
|
|
12
12
|
import '../dom/p5.File.js';
|
|
13
13
|
import '../io/p5.XML.js';
|
|
14
|
-
import '../p5.Renderer-
|
|
14
|
+
import '../p5.Renderer-R23xoC7s.js';
|
|
15
15
|
import '../image/filters.js';
|
|
16
16
|
import '../shape/custom_shapes.js';
|
|
17
17
|
import '../core/States.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import '../constants-
|
|
2
|
-
import '../creating_reading-
|
|
3
|
-
export { H as Framebuffer, E as FramebufferCamera, F as FramebufferTexture, f as default } from '../rendering
|
|
4
|
-
import '../p5.Renderer-
|
|
1
|
+
import '../constants-BRcElHU3.js';
|
|
2
|
+
import '../creating_reading-Cr8L2Jnm.js';
|
|
3
|
+
export { H as Framebuffer, E as FramebufferCamera, F as FramebufferTexture, f as default } from '../rendering-CvUVN-Vb.js';
|
|
4
|
+
import '../p5.Renderer-R23xoC7s.js';
|
|
5
5
|
import 'colorjs.io/fn';
|
|
6
6
|
import '../color/color_spaces/hsb.js';
|
|
7
7
|
import '../dom/p5.Element.js';
|
package/dist/webgl/p5.Quat.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import '../constants-
|
|
1
|
+
import '../constants-BRcElHU3.js';
|
|
2
2
|
import './GeometryBuilder.js';
|
|
3
|
-
import '../p5.Renderer-
|
|
3
|
+
import '../p5.Renderer-R23xoC7s.js';
|
|
4
4
|
import '../math/p5.Matrix.js';
|
|
5
|
-
export { R as RendererGL, r as default, B as readPixelWebGL, A as readPixelsWebGL } from '../rendering
|
|
5
|
+
export { R as RendererGL, r as default, B as readPixelWebGL, A as readPixelsWebGL } from '../rendering-CvUVN-Vb.js';
|
|
6
6
|
import '../math/p5.Vector.js';
|
|
7
7
|
import './p5.RenderBuffer.js';
|
|
8
8
|
import './p5.DataArray.js';
|
|
@@ -11,7 +11,7 @@ import './ShapeBuilder.js';
|
|
|
11
11
|
import './GeometryBufferCache.js';
|
|
12
12
|
import '../image/const.js';
|
|
13
13
|
import '../shape/custom_shapes.js';
|
|
14
|
-
import '../creating_reading-
|
|
14
|
+
import '../creating_reading-Cr8L2Jnm.js';
|
|
15
15
|
import '../math/Matrices/Matrix.js';
|
|
16
16
|
import './p5.Geometry.js';
|
|
17
17
|
import '../math/Matrices/MatrixInterface.js';
|
package/dist/webgl/p5.Shader.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { S as Shader, s as default } from '../rendering
|
|
2
|
-
import '../constants-
|
|
3
|
-
import '../creating_reading-
|
|
1
|
+
export { S as Shader, s as default } from '../rendering-CvUVN-Vb.js';
|
|
2
|
+
import '../constants-BRcElHU3.js';
|
|
3
|
+
import '../creating_reading-Cr8L2Jnm.js';
|
|
4
4
|
import 'colorjs.io/fn';
|
|
5
5
|
import '../color/color_spaces/hsb.js';
|
|
6
6
|
import '../dom/p5.Element.js';
|
|
7
7
|
import '../dom/p5.File.js';
|
|
8
8
|
import '../io/p5.XML.js';
|
|
9
|
-
import '../p5.Renderer-
|
|
9
|
+
import '../p5.Renderer-R23xoC7s.js';
|
|
10
10
|
import '../image/filters.js';
|
|
11
11
|
import '../math/p5.Vector.js';
|
|
12
12
|
import '../shape/custom_shapes.js';
|
package/dist/webgl/p5.Texture.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import '../constants-
|
|
1
|
+
import '../constants-BRcElHU3.js';
|
|
2
2
|
import '../dom/p5.Element.js';
|
|
3
|
-
import '../p5.Renderer-
|
|
3
|
+
import '../p5.Renderer-R23xoC7s.js';
|
|
4
4
|
import '../dom/p5.MediaElement.js';
|
|
5
|
-
export { M as MipmapTexture, T as Texture, D as checkWebGLCapabilities, t as default } from '../rendering
|
|
5
|
+
export { M as MipmapTexture, T as Texture, D as checkWebGLCapabilities, t as default } from '../rendering-CvUVN-Vb.js';
|
|
6
6
|
import '../dom/p5.File.js';
|
|
7
7
|
import '../io/p5.XML.js';
|
|
8
|
-
import '../creating_reading-
|
|
8
|
+
import '../creating_reading-Cr8L2Jnm.js';
|
|
9
9
|
import 'colorjs.io/fn';
|
|
10
10
|
import '../color/color_spaces/hsb.js';
|
|
11
11
|
import '../image/filters.js';
|
package/dist/webgl/text.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { T as TEXTURE } from '../constants-
|
|
2
|
-
import { R as RendererGL } from '../rendering
|
|
1
|
+
import { T as TEXTURE } from '../constants-BRcElHU3.js';
|
|
2
|
+
import { R as RendererGL } from '../rendering-CvUVN-Vb.js';
|
|
3
3
|
import { Vector } from '../math/p5.Vector.js';
|
|
4
4
|
import { Geometry } from './p5.Geometry.js';
|
|
5
5
|
import { Font, arrayCommandsToObjects } from '../type/p5.Font.js';
|
|
6
|
-
import '../creating_reading-
|
|
6
|
+
import '../creating_reading-Cr8L2Jnm.js';
|
|
7
7
|
import 'colorjs.io/fn';
|
|
8
8
|
import '../color/color_spaces/hsb.js';
|
|
9
9
|
import '../dom/p5.Element.js';
|
|
10
10
|
import '../dom/p5.File.js';
|
|
11
11
|
import '../io/p5.XML.js';
|
|
12
|
-
import '../p5.Renderer-
|
|
12
|
+
import '../p5.Renderer-R23xoC7s.js';
|
|
13
13
|
import '../image/filters.js';
|
|
14
14
|
import '../shape/custom_shapes.js';
|
|
15
15
|
import '../core/States.js';
|
|
@@ -49,24 +49,7 @@ import '@davepagurek/bezier-path';
|
|
|
49
49
|
function text(p5, fn) {
|
|
50
50
|
RendererGL.prototype.maxCachedGlyphs = function() {
|
|
51
51
|
// TODO: use more than vibes to find a good value for this
|
|
52
|
-
return 200
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
RendererGL.prototype.freeGlyphInfo = function(gi) {
|
|
56
|
-
const datas = [
|
|
57
|
-
gi.strokeImageInfo.imageData,
|
|
58
|
-
gi.rowInfo.cellImageInfo.imageData,
|
|
59
|
-
gi.rowInfo.dimImageInfo.imageData,
|
|
60
|
-
gi.colInfo.cellImageInfo.imageData,
|
|
61
|
-
gi.colInfo.dimImageInfo.imageData,
|
|
62
|
-
];
|
|
63
|
-
for (const data of datas) {
|
|
64
|
-
const tex = this.textures.get(data);
|
|
65
|
-
if (tex) {
|
|
66
|
-
tex.remove();
|
|
67
|
-
this.textures.delete(data);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
52
|
+
return 200;
|
|
70
53
|
};
|
|
71
54
|
|
|
72
55
|
Font.prototype._getFontInfo = function(axs) {
|
|
@@ -834,7 +817,7 @@ function text(p5, fn) {
|
|
|
834
817
|
sh.setUniform("uMaterialColor", curFillColor);
|
|
835
818
|
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
|
|
836
819
|
|
|
837
|
-
this.
|
|
820
|
+
this.glyphDataCache = this.glyphDataCache || new Set();
|
|
838
821
|
|
|
839
822
|
try {
|
|
840
823
|
// fetch the glyphs in the line of text
|
|
@@ -843,20 +826,35 @@ function text(p5, fn) {
|
|
|
843
826
|
for (const glyph of glyphs) {
|
|
844
827
|
const gi = fontInfo.getGlyphInfo(glyph);
|
|
845
828
|
if (gi.uGlyphRect) {
|
|
829
|
+
const rowInfo = gi.rowInfo;
|
|
830
|
+
const colInfo = gi.colInfo;
|
|
846
831
|
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
832
|
+
// Bump the resources for this glyph to the end of the cache list by deleting and re-adding
|
|
833
|
+
const glyphResources = [
|
|
834
|
+
gi.strokeImageInfo.imageData,
|
|
835
|
+
rowInfo.cellImageInfo.imageData,
|
|
836
|
+
rowInfo.dimImageInfo.imageData,
|
|
837
|
+
colInfo.cellImageInfo.imageData,
|
|
838
|
+
colInfo.dimImageInfo.imageData
|
|
839
|
+
];
|
|
840
|
+
for (const resource of glyphResources) {
|
|
841
|
+
this.glyphDataCache.delete(resource);
|
|
842
|
+
this.glyphDataCache.add(resource);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
// If we have too many glyph textures, remove the least recently used
|
|
846
|
+
// ones from GPU memory. The data still exists on the CPU and will be
|
|
847
|
+
// re-uploaded if it gets actively used again.
|
|
848
|
+
while (this.glyphDataCache.size > this.maxCachedGlyphs()) {
|
|
849
|
+
const data = this.glyphDataCache.values().next().value;
|
|
850
|
+
this.glyphDataCache.delete(data);
|
|
851
|
+
const tex = this.textures.get(data);
|
|
852
|
+
if (tex) {
|
|
853
|
+
tex.remove();
|
|
854
|
+
this.textures.delete(data);
|
|
855
|
+
}
|
|
856
856
|
}
|
|
857
857
|
|
|
858
|
-
const rowInfo = gi.rowInfo;
|
|
859
|
-
const colInfo = gi.colInfo;
|
|
860
858
|
sh.setUniform("uSamplerStrokes", gi.strokeImageInfo.imageData);
|
|
861
859
|
sh.setUniform("uSamplerRowStrokes", rowInfo.cellImageInfo.imageData);
|
|
862
860
|
sh.setUniform("uSamplerRows", rowInfo.dimImageInfo.imageData);
|