p5 2.2.1-rc.0 → 2.2.1
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 -6
- package/dist/accessibility/describe.js +4 -26
- package/dist/accessibility/index.js +5 -6
- package/dist/accessibility/outputs.js +6 -38
- package/dist/app.js +5 -6
- package/dist/color/color_conversion.js +5 -6
- 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 +59 -357
- package/dist/{constants-DEJVKr9Z.js → constants-DQyACdzq.js} +11 -61
- package/dist/core/constants.js +1 -1
- package/dist/core/environment.js +26 -158
- 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 +1 -1
- package/dist/core/friendly_errors/sketch_verifier.js +1 -1
- package/dist/core/helpers.js +1 -1
- package/dist/core/init.js +5 -6
- package/dist/core/internationalization.js +1 -1
- package/dist/core/legacy.js +5 -6
- package/dist/core/main.js +5 -6
- package/dist/core/p5.Graphics.js +4 -5
- package/dist/core/p5.Renderer.js +3 -4
- package/dist/core/p5.Renderer2D.js +5 -6
- package/dist/core/p5.Renderer3D.js +4 -5
- package/dist/core/rendering.js +4 -5
- package/dist/core/structure.js +13 -52
- package/dist/core/transform.js +32 -176
- package/dist/{creating_reading-CgHCHxqN.js → creating_reading-ZXzcZEsb.js} +3 -196
- package/dist/data/local_storage.js +4 -30
- package/dist/dom/dom.js +24 -159
- package/dist/dom/index.js +2 -2
- package/dist/dom/p5.Element.js +31 -208
- package/dist/dom/p5.File.js +1 -32
- package/dist/dom/p5.MediaElement.js +10 -113
- package/dist/events/acceleration.js +11 -64
- package/dist/events/keyboard.js +13 -81
- package/dist/events/pointer.js +18 -160
- package/dist/image/const.js +1 -1
- package/dist/image/filterRenderer2D.js +4 -5
- package/dist/image/image.js +4 -5
- package/dist/image/index.js +4 -5
- package/dist/image/loading_displaying.js +4 -5
- package/dist/image/p5.Image.js +3 -4
- package/dist/image/pixels.js +17 -100
- package/dist/io/files.js +4 -5
- package/dist/io/index.js +4 -5
- package/dist/io/p5.Table.js +66 -158
- package/dist/io/p5.TableRow.js +48 -71
- package/dist/io/p5.XML.js +6 -99
- package/dist/io/utilities.js +8 -3
- package/dist/{main-_RXV5Lx8.js → main-DvN69W3f.js} +13 -42
- package/dist/math/Matrices/Matrix.js +87 -126
- package/dist/math/Matrices/MatrixNumjs.js +1 -5
- package/dist/math/calculation.js +10 -112
- package/dist/math/index.js +1 -1
- package/dist/math/math.js +2 -12
- package/dist/math/noise.js +5 -32
- package/dist/math/p5.Matrix.js +3 -3
- package/dist/math/p5.Vector.js +104 -345
- package/dist/math/random.js +5 -32
- package/dist/math/trigonometry.js +15 -105
- package/dist/{p5.Renderer-QoFcvj3f.js → p5.Renderer-D-5LdCRz.js} +25 -178
- package/dist/{rendering-CsICjEXA.js → rendering-h9unX5K0.js} +254 -1156
- package/dist/shape/2d_primitives.js +33 -194
- package/dist/shape/attributes.js +12 -73
- package/dist/shape/curves.js +30 -95
- package/dist/shape/custom_shapes.js +63 -144
- package/dist/shape/index.js +2 -2
- package/dist/shape/vertex.js +21 -106
- package/dist/strands/p5.strands.js +248 -46
- package/dist/type/index.js +3 -4
- package/dist/type/p5.Font.js +4 -49
- package/dist/type/textCore.js +5 -158
- package/dist/utilities/conversion.js +17 -104
- package/dist/utilities/time_date.js +3 -40
- package/dist/utilities/utility_functions.js +6 -48
- package/dist/webgl/3d_primitives.js +4 -5
- package/dist/webgl/GeometryBuilder.js +1 -2
- package/dist/webgl/ShapeBuilder.js +22 -2
- package/dist/webgl/enums.js +1 -1
- package/dist/webgl/index.js +4 -5
- package/dist/webgl/interaction.js +6 -33
- package/dist/webgl/light.js +4 -5
- package/dist/webgl/loading.js +12 -46
- package/dist/webgl/material.js +4 -5
- package/dist/webgl/p5.Camera.js +4 -5
- package/dist/webgl/p5.DataArray.js +0 -4
- package/dist/webgl/p5.Framebuffer.js +4 -5
- package/dist/webgl/p5.Geometry.js +12 -106
- package/dist/webgl/p5.Quat.js +1 -1
- package/dist/webgl/p5.RendererGL.js +7 -18
- package/dist/webgl/p5.Shader.js +12 -36
- package/dist/webgl/p5.Texture.js +4 -5
- package/dist/webgl/text.js +4 -5
- package/dist/webgl/utils.js +4 -5
- package/dist/webgpu/index.js +1 -1
- package/dist/webgpu/p5.RendererWebGPU.js +529 -208
- package/dist/webgpu/shaders/color.js +32 -17
- package/dist/webgpu/shaders/filters/base.js +18 -7
- package/dist/webgpu/shaders/font.js +52 -40
- package/dist/webgpu/shaders/line.js +50 -36
- package/dist/webgpu/shaders/material.js +90 -83
- package/dist/webgpu/strands_wgslBackend.js +5 -2
- package/lib/p5.esm.js +5576 -7811
- package/lib/p5.esm.min.js +1 -1
- package/lib/p5.js +5576 -7811
- package/lib/p5.min.js +1 -1
- package/lib/p5.webgpu.esm.js +786 -453
- package/lib/p5.webgpu.js +786 -453
- package/lib/p5.webgpu.min.js +1 -1
- package/package.json +13 -13
- package/types/global.d.ts +16905 -16783
- package/types/p5.d.ts +11142 -11081
|
@@ -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-
|
|
2
|
-
import { C as Color, c as creatingReading, h as RGBA, R as RGB } from './creating_reading-
|
|
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-DQyACdzq.js';
|
|
2
|
+
import { C as Color, c as creatingReading, h as RGBA, R as RGB } from './creating_reading-ZXzcZEsb.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-D-5LdCRz.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';
|
|
@@ -65,8 +65,6 @@ function image(p5, fn){
|
|
|
65
65
|
* @return {p5.Image} new <a href="#/p5.Image">p5.Image</a> object.
|
|
66
66
|
*
|
|
67
67
|
* @example
|
|
68
|
-
* <div>
|
|
69
|
-
* <code>
|
|
70
68
|
* function setup() {
|
|
71
69
|
* createCanvas(100, 100);
|
|
72
70
|
*
|
|
@@ -93,11 +91,8 @@ function image(p5, fn){
|
|
|
93
91
|
*
|
|
94
92
|
* describe('A black square drawn in the middle of a gray square.');
|
|
95
93
|
* }
|
|
96
|
-
* </code>
|
|
97
|
-
* </div>
|
|
98
94
|
*
|
|
99
|
-
*
|
|
100
|
-
* <code>
|
|
95
|
+
* @example
|
|
101
96
|
* function setup() {
|
|
102
97
|
* createCanvas(100, 100);
|
|
103
98
|
*
|
|
@@ -131,11 +126,8 @@ function image(p5, fn){
|
|
|
131
126
|
*
|
|
132
127
|
* describe('A square with a horizontal color gradient that transitions from gray to black.');
|
|
133
128
|
* }
|
|
134
|
-
* </code>
|
|
135
|
-
* </div>
|
|
136
129
|
*
|
|
137
|
-
*
|
|
138
|
-
* <code>
|
|
130
|
+
* @example
|
|
139
131
|
* function setup() {
|
|
140
132
|
* createCanvas(100, 100);
|
|
141
133
|
*
|
|
@@ -172,8 +164,6 @@ function image(p5, fn){
|
|
|
172
164
|
*
|
|
173
165
|
* describe('A black square drawn in the middle of a gray square.');
|
|
174
166
|
* }
|
|
175
|
-
* </code>
|
|
176
|
-
* </div>
|
|
177
167
|
*/
|
|
178
168
|
fn.createImage = function(width, height) {
|
|
179
169
|
// p5._validateParameters('createImage', arguments);
|
|
@@ -204,9 +194,8 @@ function image(p5, fn){
|
|
|
204
194
|
* @param {String} [filename] file name. Defaults to 'untitled'.
|
|
205
195
|
* @param {String} [extension] file extension, either 'png', 'webp', or 'jpg'. Defaults to 'png'.
|
|
206
196
|
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* <code>
|
|
197
|
+
* @example
|
|
198
|
+
* // META:norender
|
|
210
199
|
* function setup() {
|
|
211
200
|
* createCanvas(100, 100);
|
|
212
201
|
* background(255);
|
|
@@ -216,11 +205,9 @@ function image(p5, fn){
|
|
|
216
205
|
*
|
|
217
206
|
* describe('A white square.');
|
|
218
207
|
* }
|
|
219
|
-
* </code>
|
|
220
|
-
* </div>
|
|
221
208
|
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
209
|
+
* @example
|
|
210
|
+
* // META:norender
|
|
224
211
|
* function setup() {
|
|
225
212
|
* createCanvas(100, 100);
|
|
226
213
|
*
|
|
@@ -231,11 +218,9 @@ function image(p5, fn){
|
|
|
231
218
|
*
|
|
232
219
|
* describe('A white square.');
|
|
233
220
|
* }
|
|
234
|
-
* </code>
|
|
235
|
-
* </div>
|
|
236
221
|
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
222
|
+
* @example
|
|
223
|
+
* // META:norender
|
|
239
224
|
* function setup() {
|
|
240
225
|
* createCanvas(100, 100);
|
|
241
226
|
*
|
|
@@ -246,11 +231,9 @@ function image(p5, fn){
|
|
|
246
231
|
*
|
|
247
232
|
* describe('A white square.');
|
|
248
233
|
* }
|
|
249
|
-
* </code>
|
|
250
|
-
* </div>
|
|
251
234
|
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
235
|
+
* @example
|
|
236
|
+
* // META:norender
|
|
254
237
|
* function setup() {
|
|
255
238
|
* let cnv = createCanvas(100, 100);
|
|
256
239
|
*
|
|
@@ -261,11 +244,9 @@ function image(p5, fn){
|
|
|
261
244
|
*
|
|
262
245
|
* describe('A white square.');
|
|
263
246
|
* }
|
|
264
|
-
* </code>
|
|
265
|
-
* </div>
|
|
266
247
|
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
248
|
+
* @example
|
|
249
|
+
* // META:norender
|
|
269
250
|
* function setup() {
|
|
270
251
|
* let cnv = createCanvas(100, 100);
|
|
271
252
|
*
|
|
@@ -276,11 +257,9 @@ function image(p5, fn){
|
|
|
276
257
|
*
|
|
277
258
|
* describe('A white square.');
|
|
278
259
|
* }
|
|
279
|
-
* </code>
|
|
280
|
-
* </div>
|
|
281
260
|
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
261
|
+
* @example
|
|
262
|
+
* // META:norender
|
|
284
263
|
* function setup() {
|
|
285
264
|
* let cnv = createCanvas(100, 100);
|
|
286
265
|
*
|
|
@@ -291,8 +270,6 @@ function image(p5, fn){
|
|
|
291
270
|
*
|
|
292
271
|
* describe('A white square.');
|
|
293
272
|
* }
|
|
294
|
-
* </code>
|
|
295
|
-
* </div>
|
|
296
273
|
*/
|
|
297
274
|
/**
|
|
298
275
|
* @method saveCanvas
|
|
@@ -636,8 +613,6 @@ function image(p5, fn){
|
|
|
636
613
|
* frames of objects. Each object has three
|
|
637
614
|
* properties: `imageData`, `filename`, and `extension`.
|
|
638
615
|
* @example
|
|
639
|
-
* <div>
|
|
640
|
-
* <code>
|
|
641
616
|
* function setup() {
|
|
642
617
|
* createCanvas(100, 100);
|
|
643
618
|
*
|
|
@@ -657,11 +632,8 @@ function image(p5, fn){
|
|
|
657
632
|
* saveFrames('frame', 'png', 1, 5);
|
|
658
633
|
* }
|
|
659
634
|
* }
|
|
660
|
-
* </code>
|
|
661
|
-
* </div>
|
|
662
635
|
*
|
|
663
|
-
*
|
|
664
|
-
* <code>
|
|
636
|
+
* @example
|
|
665
637
|
* function setup() {
|
|
666
638
|
* createCanvas(100, 100);
|
|
667
639
|
*
|
|
@@ -686,8 +658,6 @@ function image(p5, fn){
|
|
|
686
658
|
* print(frame);
|
|
687
659
|
* }
|
|
688
660
|
* }
|
|
689
|
-
* </code>
|
|
690
|
-
* </div>
|
|
691
661
|
*/
|
|
692
662
|
fn.saveFrames = function(fName, ext, _duration, _fps, callback) {
|
|
693
663
|
// p5._validateParameters('saveFrames', arguments);
|
|
@@ -875,9 +845,6 @@ function files(p5, fn){
|
|
|
875
845
|
* @return {Promise<Object>} object containing the loaded data.
|
|
876
846
|
*
|
|
877
847
|
* @example
|
|
878
|
-
*
|
|
879
|
-
* <div>
|
|
880
|
-
* <code>
|
|
881
848
|
* let myData;
|
|
882
849
|
*
|
|
883
850
|
* async function setup() {
|
|
@@ -895,11 +862,8 @@ function files(p5, fn){
|
|
|
895
862
|
*
|
|
896
863
|
* describe('A pink circle on a gray background.');
|
|
897
864
|
* }
|
|
898
|
-
* </code>
|
|
899
|
-
* </div>
|
|
900
865
|
*
|
|
901
|
-
*
|
|
902
|
-
* <code>
|
|
866
|
+
* @example
|
|
903
867
|
* let myData;
|
|
904
868
|
*
|
|
905
869
|
* async function setup() {
|
|
@@ -924,11 +888,8 @@ function files(p5, fn){
|
|
|
924
888
|
*
|
|
925
889
|
* describe('Several pink bubbles floating in a blue sky.');
|
|
926
890
|
* }
|
|
927
|
-
* </code>
|
|
928
|
-
* </div>
|
|
929
891
|
*
|
|
930
|
-
*
|
|
931
|
-
* <code>
|
|
892
|
+
* @example
|
|
932
893
|
* let myData;
|
|
933
894
|
*
|
|
934
895
|
* async function setup() {
|
|
@@ -953,11 +914,8 @@ function files(p5, fn){
|
|
|
953
914
|
*
|
|
954
915
|
* describe(`A white circle on a gray background. The text "${quake.place}" is written beneath the circle.`);
|
|
955
916
|
* }
|
|
956
|
-
* </code>
|
|
957
|
-
* </div>
|
|
958
917
|
*
|
|
959
|
-
*
|
|
960
|
-
* <code>
|
|
918
|
+
* @example
|
|
961
919
|
* let bigQuake;
|
|
962
920
|
*
|
|
963
921
|
* // Load the GeoJSON and preprocess it.
|
|
@@ -997,11 +955,8 @@ function files(p5, fn){
|
|
|
997
955
|
* }
|
|
998
956
|
* }
|
|
999
957
|
* }
|
|
1000
|
-
* </code>
|
|
1001
|
-
* </div>
|
|
1002
958
|
*
|
|
1003
|
-
*
|
|
1004
|
-
* <code>
|
|
959
|
+
* @example
|
|
1005
960
|
* let bigQuake;
|
|
1006
961
|
*
|
|
1007
962
|
* // Load the GeoJSON and preprocess it.
|
|
@@ -1047,8 +1002,6 @@ function files(p5, fn){
|
|
|
1047
1002
|
* function handleError(error) {
|
|
1048
1003
|
* console.log('Oops!', error);
|
|
1049
1004
|
* }
|
|
1050
|
-
* </code>
|
|
1051
|
-
* </div>
|
|
1052
1005
|
*/
|
|
1053
1006
|
fn.loadJSON = async function (path, successCallback, errorCallback) {
|
|
1054
1007
|
// p5._validateParameters('loadJSON', arguments);
|
|
@@ -1104,9 +1057,6 @@ function files(p5, fn){
|
|
|
1104
1057
|
* @return {Promise<String[]>} new array containing the loaded text.
|
|
1105
1058
|
*
|
|
1106
1059
|
* @example
|
|
1107
|
-
*
|
|
1108
|
-
* <div>
|
|
1109
|
-
* <code>
|
|
1110
1060
|
* let myData;
|
|
1111
1061
|
*
|
|
1112
1062
|
* async function setup() {
|
|
@@ -1129,11 +1079,8 @@ function files(p5, fn){
|
|
|
1129
1079
|
*
|
|
1130
1080
|
* describe(`The text "${phrase}" written in black on a gray background.`);
|
|
1131
1081
|
* }
|
|
1132
|
-
* </code>
|
|
1133
|
-
* </div>
|
|
1134
1082
|
*
|
|
1135
|
-
*
|
|
1136
|
-
* <code>
|
|
1083
|
+
* @example
|
|
1137
1084
|
* let lastLine;
|
|
1138
1085
|
*
|
|
1139
1086
|
* // Load the text and preprocess it.
|
|
@@ -1159,11 +1106,8 @@ function files(p5, fn){
|
|
|
1159
1106
|
* function handleData(data) {
|
|
1160
1107
|
* lastLine = data[data.length - 1];
|
|
1161
1108
|
* }
|
|
1162
|
-
* </code>
|
|
1163
|
-
* </div>
|
|
1164
1109
|
*
|
|
1165
|
-
*
|
|
1166
|
-
* <code>
|
|
1110
|
+
* @example
|
|
1167
1111
|
* let lastLine;
|
|
1168
1112
|
*
|
|
1169
1113
|
* // Load the text and preprocess it.
|
|
@@ -1194,8 +1138,6 @@ function files(p5, fn){
|
|
|
1194
1138
|
* function handleError(error) {
|
|
1195
1139
|
* console.error('Oops!', error);
|
|
1196
1140
|
* }
|
|
1197
|
-
* </code>
|
|
1198
|
-
* </div>
|
|
1199
1141
|
*/
|
|
1200
1142
|
fn.loadStrings = async function (path, successCallback, errorCallback) {
|
|
1201
1143
|
// p5._validateParameters('loadStrings', arguments);
|
|
@@ -1244,8 +1186,7 @@ function files(p5, fn){
|
|
|
1244
1186
|
* @return {Promise<Object>} <a href="#/p5.Table">Table</a> object containing data
|
|
1245
1187
|
*
|
|
1246
1188
|
* @example
|
|
1247
|
-
*
|
|
1248
|
-
* <code>
|
|
1189
|
+
* // META:norender
|
|
1249
1190
|
* let table;
|
|
1250
1191
|
*
|
|
1251
1192
|
* async function setup() {
|
|
@@ -1268,8 +1209,6 @@ function files(p5, fn){
|
|
|
1268
1209
|
* text(row.getString(c), 10, 30 + c * 20);
|
|
1269
1210
|
* }
|
|
1270
1211
|
* }
|
|
1271
|
-
* </code>
|
|
1272
|
-
* </div>
|
|
1273
1212
|
*/
|
|
1274
1213
|
fn.loadTable = async function (
|
|
1275
1214
|
path,
|
|
@@ -1369,8 +1308,6 @@ function files(p5, fn){
|
|
|
1369
1308
|
* object.
|
|
1370
1309
|
*
|
|
1371
1310
|
* @example
|
|
1372
|
-
* <div>
|
|
1373
|
-
* <code>
|
|
1374
1311
|
* let myXML;
|
|
1375
1312
|
*
|
|
1376
1313
|
* // Load the XML and create a p5.XML object.
|
|
@@ -1406,11 +1343,8 @@ function files(p5, fn){
|
|
|
1406
1343
|
* 'The words "Goat", "Leopard", and "Zebra" written on three separate lines. The text is black on a gray background.'
|
|
1407
1344
|
* );
|
|
1408
1345
|
* }
|
|
1409
|
-
* </code>
|
|
1410
|
-
* </div>
|
|
1411
1346
|
*
|
|
1412
|
-
*
|
|
1413
|
-
* <code>
|
|
1347
|
+
* @example
|
|
1414
1348
|
* let lastMammal;
|
|
1415
1349
|
*
|
|
1416
1350
|
* // Load the XML and create a p5.XML object.
|
|
@@ -1440,11 +1374,8 @@ function files(p5, fn){
|
|
|
1440
1374
|
* // Get the content of the last mammal.
|
|
1441
1375
|
* lastMammal = mammals[mammals.length - 1].getContent();
|
|
1442
1376
|
* }
|
|
1443
|
-
* </code>
|
|
1444
|
-
* </div>
|
|
1445
1377
|
*
|
|
1446
|
-
*
|
|
1447
|
-
* <code>
|
|
1378
|
+
* @example
|
|
1448
1379
|
* let lastMammal;
|
|
1449
1380
|
*
|
|
1450
1381
|
* // Load the XML and preprocess it.
|
|
@@ -1479,8 +1410,6 @@ function files(p5, fn){
|
|
|
1479
1410
|
* function handleError(error) {
|
|
1480
1411
|
* console.error('Oops!', error);
|
|
1481
1412
|
* }
|
|
1482
|
-
* </code>
|
|
1483
|
-
* </div>
|
|
1484
1413
|
*/
|
|
1485
1414
|
fn.loadXML = async function (path, successCallback, errorCallback) {
|
|
1486
1415
|
try{
|
|
@@ -1514,30 +1443,24 @@ function files(p5, fn){
|
|
|
1514
1443
|
* @returns {Promise<Uint8Array>} a Uint8Array containing the loaded buffer
|
|
1515
1444
|
*
|
|
1516
1445
|
* @example
|
|
1517
|
-
*
|
|
1518
|
-
* <div>
|
|
1519
|
-
* <code>
|
|
1520
1446
|
* let data;
|
|
1521
1447
|
*
|
|
1522
1448
|
* async function setup() {
|
|
1523
|
-
*
|
|
1524
|
-
*
|
|
1449
|
+
* createCanvas(100, 100); // Create a canvas
|
|
1450
|
+
* data = await loadBytes('assets/mammals.xml'); // Load the bytes from the XML file
|
|
1525
1451
|
*
|
|
1526
|
-
*
|
|
1527
|
-
*
|
|
1452
|
+
* background(255); // Set a white background
|
|
1453
|
+
* fill(0); // Set text color to black
|
|
1528
1454
|
*
|
|
1529
|
-
*
|
|
1530
|
-
*
|
|
1531
|
-
*
|
|
1532
|
-
*
|
|
1533
|
-
*
|
|
1455
|
+
* // Display the first 5 byte values on the canvas in hexadecimal format
|
|
1456
|
+
* for (let i = 0; i < 5; i++) {
|
|
1457
|
+
* let byteHex = data[i].toString(16);
|
|
1458
|
+
* text(byteHex, 10, 18 * (i + 1)); // Adjust spacing as needed
|
|
1459
|
+
* }
|
|
1534
1460
|
*
|
|
1535
|
-
*
|
|
1461
|
+
* describe('no image displayed, displays first 5 bytes of mammals.xml in hexadecimal format');
|
|
1536
1462
|
* }
|
|
1537
|
-
* </code>
|
|
1538
|
-
* </div>
|
|
1539
1463
|
*/
|
|
1540
|
-
|
|
1541
1464
|
fn.loadBytes = async function (path, successCallback, errorCallback) {
|
|
1542
1465
|
try{
|
|
1543
1466
|
let { data } = await request(path, 'arrayBuffer');
|
|
@@ -1571,8 +1494,6 @@ function files(p5, fn){
|
|
|
1571
1494
|
* @returns {Promise<Blob>} A promise that resolves with the loaded Blob.
|
|
1572
1495
|
*
|
|
1573
1496
|
* @example
|
|
1574
|
-
* <div>
|
|
1575
|
-
* <code>
|
|
1576
1497
|
* let myBlob;
|
|
1577
1498
|
*
|
|
1578
1499
|
* async function setup() {
|
|
@@ -1594,8 +1515,6 @@ function files(p5, fn){
|
|
|
1594
1515
|
* console.error('Error loading blob:', err);
|
|
1595
1516
|
* }
|
|
1596
1517
|
* }
|
|
1597
|
-
* </code>
|
|
1598
|
-
* </div>
|
|
1599
1518
|
*/
|
|
1600
1519
|
fn.loadBlob = async function(path, successCallback, errorCallback) {
|
|
1601
1520
|
try{
|
|
@@ -1632,7 +1551,7 @@ function files(p5, fn){
|
|
|
1632
1551
|
* completes successfully or rejects with the error after
|
|
1633
1552
|
* one occurs.
|
|
1634
1553
|
* @example
|
|
1635
|
-
*
|
|
1554
|
+
* // META:norender
|
|
1636
1555
|
* // Examples use USGS Earthquake API:
|
|
1637
1556
|
* // https://earthquake.usgs.gov/fdsnws/event/1/#methods
|
|
1638
1557
|
* let earthquakes;
|
|
@@ -1658,7 +1577,6 @@ function files(p5, fn){
|
|
|
1658
1577
|
* text(earthquakeName, 0, height - 30, width, 30);
|
|
1659
1578
|
* noLoop();
|
|
1660
1579
|
* }
|
|
1661
|
-
* </code></div>
|
|
1662
1580
|
*/
|
|
1663
1581
|
/**
|
|
1664
1582
|
* @method httpGet
|
|
@@ -1703,8 +1621,6 @@ function files(p5, fn){
|
|
|
1703
1621
|
* one occurs.
|
|
1704
1622
|
*
|
|
1705
1623
|
* @example
|
|
1706
|
-
* <div>
|
|
1707
|
-
* <code>
|
|
1708
1624
|
* // Examples use jsonplaceholder.typicode.com for a Mock Data API
|
|
1709
1625
|
*
|
|
1710
1626
|
* let url = 'https://jsonplaceholder.typicode.com/posts';
|
|
@@ -1721,10 +1637,8 @@ function files(p5, fn){
|
|
|
1721
1637
|
* text(result.body, mouseX, mouseY);
|
|
1722
1638
|
* });
|
|
1723
1639
|
* }
|
|
1724
|
-
* </code>
|
|
1725
|
-
* </div>
|
|
1726
1640
|
*
|
|
1727
|
-
*
|
|
1641
|
+
* @example
|
|
1728
1642
|
* let url = 'ttps://invalidURL'; // A bad URL that will cause errors
|
|
1729
1643
|
* let postData = { title: 'p5 Clicked!', body: 'p5.js is very cool.' };
|
|
1730
1644
|
*
|
|
@@ -1747,7 +1661,6 @@ function files(p5, fn){
|
|
|
1747
1661
|
* }
|
|
1748
1662
|
* );
|
|
1749
1663
|
* }
|
|
1750
|
-
* </code></div>
|
|
1751
1664
|
*/
|
|
1752
1665
|
/**
|
|
1753
1666
|
* @method httpPost
|
|
@@ -1845,8 +1758,6 @@ function files(p5, fn){
|
|
|
1845
1758
|
* one occurs.
|
|
1846
1759
|
*
|
|
1847
1760
|
* @example
|
|
1848
|
-
* <div>
|
|
1849
|
-
* <code>
|
|
1850
1761
|
* // Examples use USGS Earthquake API:
|
|
1851
1762
|
* // https://earthquake.usgs.gov/fdsnws/event/1/#methods
|
|
1852
1763
|
*
|
|
@@ -1897,8 +1808,6 @@ function files(p5, fn){
|
|
|
1897
1808
|
* eqFeatureIndex += 1;
|
|
1898
1809
|
* }
|
|
1899
1810
|
* }
|
|
1900
|
-
* </code>
|
|
1901
|
-
* </div>
|
|
1902
1811
|
*/
|
|
1903
1812
|
/**
|
|
1904
1813
|
* @method httpDo
|
|
@@ -2005,8 +1914,6 @@ function files(p5, fn){
|
|
|
2005
1914
|
* @return {p5.PrintWriter} stream for writing data.
|
|
2006
1915
|
*
|
|
2007
1916
|
* @example
|
|
2008
|
-
* <div>
|
|
2009
|
-
* <code>
|
|
2010
1917
|
* function setup() {
|
|
2011
1918
|
* createCanvas(100, 100);
|
|
2012
1919
|
*
|
|
@@ -2038,11 +1945,8 @@ function files(p5, fn){
|
|
|
2038
1945
|
* myWriter.close();
|
|
2039
1946
|
* }
|
|
2040
1947
|
* }
|
|
2041
|
-
* </code>
|
|
2042
|
-
* </div>
|
|
2043
1948
|
*
|
|
2044
|
-
*
|
|
2045
|
-
* <code>
|
|
1949
|
+
* @example
|
|
2046
1950
|
* function setup() {
|
|
2047
1951
|
* createCanvas(100, 100);
|
|
2048
1952
|
*
|
|
@@ -2079,8 +1983,6 @@ function files(p5, fn){
|
|
|
2079
1983
|
* myWriter.close();
|
|
2080
1984
|
* }
|
|
2081
1985
|
* }
|
|
2082
|
-
* </code>
|
|
2083
|
-
* </div>
|
|
2084
1986
|
*/
|
|
2085
1987
|
fn.createWriter = function (name, extension) {
|
|
2086
1988
|
let newPW;
|
|
@@ -2118,8 +2020,6 @@ function files(p5, fn){
|
|
|
2118
2020
|
* @param {String} [extension] format to use for the file.
|
|
2119
2021
|
*
|
|
2120
2022
|
* @example
|
|
2121
|
-
* <div>
|
|
2122
|
-
* <code>
|
|
2123
2023
|
* function setup() {
|
|
2124
2024
|
* createCanvas(100, 100);
|
|
2125
2025
|
*
|
|
@@ -2149,8 +2049,6 @@ function files(p5, fn){
|
|
|
2149
2049
|
* // Save the file and close the print stream.
|
|
2150
2050
|
* myWriter.close();
|
|
2151
2051
|
* }
|
|
2152
|
-
* </code>
|
|
2153
|
-
* </div>
|
|
2154
2052
|
*/
|
|
2155
2053
|
p5.PrintWriter = function (filename, extension) {
|
|
2156
2054
|
let self = this;
|
|
@@ -2170,8 +2068,6 @@ function files(p5, fn){
|
|
|
2170
2068
|
* or array of strings and numbers.
|
|
2171
2069
|
*
|
|
2172
2070
|
* @example
|
|
2173
|
-
* <div>
|
|
2174
|
-
* <code>
|
|
2175
2071
|
* function setup() {
|
|
2176
2072
|
* createCanvas(100, 100);
|
|
2177
2073
|
*
|
|
@@ -2200,8 +2096,6 @@ function files(p5, fn){
|
|
|
2200
2096
|
* // Save the file and close the print stream.
|
|
2201
2097
|
* myWriter.close();
|
|
2202
2098
|
* }
|
|
2203
|
-
* </code>
|
|
2204
|
-
* </div>
|
|
2205
2099
|
*/
|
|
2206
2100
|
this.write = function (data) {
|
|
2207
2101
|
this.content += data;
|
|
@@ -2220,8 +2114,6 @@ function files(p5, fn){
|
|
|
2220
2114
|
* or array of strings and numbers.
|
|
2221
2115
|
*
|
|
2222
2116
|
* @example
|
|
2223
|
-
* <div>
|
|
2224
|
-
* <code>
|
|
2225
2117
|
* function setup() {
|
|
2226
2118
|
* createCanvas(100, 100);
|
|
2227
2119
|
*
|
|
@@ -2250,8 +2142,6 @@ function files(p5, fn){
|
|
|
2250
2142
|
* // Save the file and close the print stream.
|
|
2251
2143
|
* myWriter.close();
|
|
2252
2144
|
* }
|
|
2253
|
-
* </code>
|
|
2254
|
-
* </div>
|
|
2255
2145
|
*/
|
|
2256
2146
|
this.print = function (data) {
|
|
2257
2147
|
this.content += `${data}\n`;
|
|
@@ -2263,8 +2153,6 @@ function files(p5, fn){
|
|
|
2263
2153
|
* @method clear
|
|
2264
2154
|
*
|
|
2265
2155
|
* @example
|
|
2266
|
-
* <div>
|
|
2267
|
-
* <code>
|
|
2268
2156
|
* function setup() {
|
|
2269
2157
|
* createCanvas(100, 100);
|
|
2270
2158
|
*
|
|
@@ -2295,8 +2183,6 @@ function files(p5, fn){
|
|
|
2295
2183
|
* // Save the file and close the print stream.
|
|
2296
2184
|
* myWriter.close();
|
|
2297
2185
|
* }
|
|
2298
|
-
* </code>
|
|
2299
|
-
* </div>
|
|
2300
2186
|
*/
|
|
2301
2187
|
this.clear = function () {
|
|
2302
2188
|
this.content = '';
|
|
@@ -2308,8 +2194,6 @@ function files(p5, fn){
|
|
|
2308
2194
|
* @method close
|
|
2309
2195
|
*
|
|
2310
2196
|
* @example
|
|
2311
|
-
* <div>
|
|
2312
|
-
* <code>
|
|
2313
2197
|
* function setup() {
|
|
2314
2198
|
* createCanvas(100, 100);
|
|
2315
2199
|
*
|
|
@@ -2341,8 +2225,6 @@ function files(p5, fn){
|
|
|
2341
2225
|
* // Save the file and close the print stream.
|
|
2342
2226
|
* myWriter.close();
|
|
2343
2227
|
* }
|
|
2344
|
-
* </code>
|
|
2345
|
-
* </div>
|
|
2346
2228
|
*/
|
|
2347
2229
|
this.close = function () {
|
|
2348
2230
|
// convert String to Array for the writeFile Blob
|
|
@@ -2407,7 +2289,7 @@ function files(p5, fn){
|
|
|
2407
2289
|
* rather than readability.
|
|
2408
2290
|
*
|
|
2409
2291
|
* @example
|
|
2410
|
-
*
|
|
2292
|
+
* // META:norender
|
|
2411
2293
|
* // Saves the canvas as an image
|
|
2412
2294
|
* cnv = createCanvas(300, 300);
|
|
2413
2295
|
* save(cnv, 'myCanvas.jpg');
|
|
@@ -2415,23 +2297,23 @@ function files(p5, fn){
|
|
|
2415
2297
|
* // Saves the canvas as an image by default
|
|
2416
2298
|
* save('myCanvas.jpg');
|
|
2417
2299
|
* describe('An example for saving a canvas as an image.');
|
|
2418
|
-
* </code></div>
|
|
2419
2300
|
*
|
|
2420
|
-
*
|
|
2301
|
+
* @example
|
|
2302
|
+
* // META:norender
|
|
2421
2303
|
* // Saves p5.Image as an image
|
|
2422
2304
|
* img = createImage(10, 10);
|
|
2423
2305
|
* save(img, 'myImage.png');
|
|
2424
2306
|
* describe('An example for saving a p5.Image element as an image.');
|
|
2425
|
-
* </code></div>
|
|
2426
2307
|
*
|
|
2427
|
-
*
|
|
2308
|
+
* @example
|
|
2309
|
+
* // META:norender
|
|
2428
2310
|
* // Saves p5.Renderer object as an image
|
|
2429
2311
|
* obj = createGraphics(100, 100);
|
|
2430
2312
|
* save(obj, 'myObject.png');
|
|
2431
2313
|
* describe('An example for saving a p5.Renderer element.');
|
|
2432
|
-
* </code></div>
|
|
2433
2314
|
*
|
|
2434
|
-
*
|
|
2315
|
+
* @example
|
|
2316
|
+
* // META:norender
|
|
2435
2317
|
* let myTable = new p5.Table();
|
|
2436
2318
|
* // Saves table as html file
|
|
2437
2319
|
* save(myTable, 'myTable.html');
|
|
@@ -2444,9 +2326,9 @@ function files(p5, fn){
|
|
|
2444
2326
|
*
|
|
2445
2327
|
* describe(`An example showing how to save a table in formats of
|
|
2446
2328
|
* HTML, CSV and TSV.`);
|
|
2447
|
-
* </code></div>
|
|
2448
2329
|
*
|
|
2449
|
-
*
|
|
2330
|
+
* @example
|
|
2331
|
+
* // META:norender
|
|
2450
2332
|
* let myJSON = { a: 1, b: true };
|
|
2451
2333
|
*
|
|
2452
2334
|
* // Saves pretty JSON
|
|
@@ -2456,15 +2338,14 @@ function files(p5, fn){
|
|
|
2456
2338
|
* save(myJSON, 'my.json', true);
|
|
2457
2339
|
*
|
|
2458
2340
|
* describe('An example for saving JSON to a txt file with some extra arguments.');
|
|
2459
|
-
* </code></div>
|
|
2460
2341
|
*
|
|
2461
|
-
*
|
|
2342
|
+
* @example
|
|
2343
|
+
* // META:norender
|
|
2462
2344
|
* // Saves array of strings to text file with line breaks after each item
|
|
2463
2345
|
* let arrayOfStrings = ['a', 'b'];
|
|
2464
2346
|
* save(arrayOfStrings, 'my.txt');
|
|
2465
2347
|
* describe(`An example for saving an array of strings to text file
|
|
2466
2348
|
* with line breaks.`);
|
|
2467
|
-
* </code></div>
|
|
2468
2349
|
*/
|
|
2469
2350
|
fn.save = function (object, _filename, _options) {
|
|
2470
2351
|
// TODO: parameters is not used correctly
|
|
@@ -2548,8 +2429,6 @@ function files(p5, fn){
|
|
|
2548
2429
|
* to `true`.
|
|
2549
2430
|
*
|
|
2550
2431
|
* @example
|
|
2551
|
-
* <div>
|
|
2552
|
-
* <code>
|
|
2553
2432
|
* function setup() {
|
|
2554
2433
|
* createCanvas(100, 100);
|
|
2555
2434
|
*
|
|
@@ -2576,11 +2455,8 @@ function files(p5, fn){
|
|
|
2576
2455
|
* saveJSON(data, 'numbers.json');
|
|
2577
2456
|
* }
|
|
2578
2457
|
* }
|
|
2579
|
-
* </code>
|
|
2580
|
-
* </div>
|
|
2581
2458
|
*
|
|
2582
|
-
*
|
|
2583
|
-
* <code>
|
|
2459
|
+
* @example
|
|
2584
2460
|
* function setup() {
|
|
2585
2461
|
* createCanvas(100, 100);
|
|
2586
2462
|
*
|
|
@@ -2607,11 +2483,8 @@ function files(p5, fn){
|
|
|
2607
2483
|
* saveJSON(data, 'state.json');
|
|
2608
2484
|
* }
|
|
2609
2485
|
* }
|
|
2610
|
-
* </code>
|
|
2611
|
-
* </div>
|
|
2612
2486
|
*
|
|
2613
|
-
*
|
|
2614
|
-
* <code>
|
|
2487
|
+
* @example
|
|
2615
2488
|
* function setup() {
|
|
2616
2489
|
* createCanvas(100, 100);
|
|
2617
2490
|
*
|
|
@@ -2638,8 +2511,6 @@ function files(p5, fn){
|
|
|
2638
2511
|
* saveJSON(data, 'state.json', true);
|
|
2639
2512
|
* }
|
|
2640
2513
|
* }
|
|
2641
|
-
* </code>
|
|
2642
|
-
* </div>
|
|
2643
2514
|
*/
|
|
2644
2515
|
fn.saveJSON = function (json, filename, optimize) {
|
|
2645
2516
|
// p5._validateParameters('saveJSON', arguments);
|
|
@@ -2684,8 +2555,6 @@ function files(p5, fn){
|
|
|
2684
2555
|
* string. Defaults to `false`.
|
|
2685
2556
|
*
|
|
2686
2557
|
* @example
|
|
2687
|
-
* <div>
|
|
2688
|
-
* <code>
|
|
2689
2558
|
* function setup() {
|
|
2690
2559
|
* createCanvas(100, 100);
|
|
2691
2560
|
*
|
|
@@ -2712,11 +2581,8 @@ function files(p5, fn){
|
|
|
2712
2581
|
* saveStrings(data, 'data.txt');
|
|
2713
2582
|
* }
|
|
2714
2583
|
* }
|
|
2715
|
-
* </code>
|
|
2716
|
-
* </div>
|
|
2717
2584
|
*
|
|
2718
|
-
*
|
|
2719
|
-
* <code>
|
|
2585
|
+
* @example
|
|
2720
2586
|
* function setup() {
|
|
2721
2587
|
* createCanvas(100, 100);
|
|
2722
2588
|
*
|
|
@@ -2745,11 +2611,8 @@ function files(p5, fn){
|
|
|
2745
2611
|
* saveStrings(data, 'cat', 'txt');
|
|
2746
2612
|
* }
|
|
2747
2613
|
* }
|
|
2748
|
-
* </code>
|
|
2749
|
-
* </div>
|
|
2750
2614
|
*
|
|
2751
|
-
*
|
|
2752
|
-
* <code>
|
|
2615
|
+
* @example
|
|
2753
2616
|
* function setup() {
|
|
2754
2617
|
* createCanvas(100, 100);
|
|
2755
2618
|
*
|
|
@@ -2782,8 +2645,6 @@ function files(p5, fn){
|
|
|
2782
2645
|
* saveStrings(data, 'box', 'txt', true);
|
|
2783
2646
|
* }
|
|
2784
2647
|
* }
|
|
2785
|
-
* </code>
|
|
2786
|
-
* </div>
|
|
2787
2648
|
*/
|
|
2788
2649
|
fn.saveStrings = function (list, filename, extension, isCRLF) {
|
|
2789
2650
|
// p5._validateParameters('saveStrings', arguments);
|
|
@@ -2810,19 +2671,18 @@ function files(p5, fn){
|
|
|
2810
2671
|
}
|
|
2811
2672
|
|
|
2812
2673
|
/**
|
|
2813
|
-
*
|
|
2814
|
-
*
|
|
2815
|
-
*
|
|
2816
|
-
*
|
|
2817
|
-
*
|
|
2674
|
+
* Writes the contents of a <a href="#/p5.Table">Table</a> object to a file. Defaults to a
|
|
2675
|
+
* text file with comma-separated-values ('csv') but can also
|
|
2676
|
+
* use tab separation ('tsv'), or generate an HTML table ('html').
|
|
2677
|
+
* The file saving process and location of the saved file will
|
|
2678
|
+
* vary between web browsers.
|
|
2818
2679
|
*
|
|
2819
|
-
*
|
|
2680
|
+
* @method saveTable
|
|
2820
2681
|
* @deprecated p5.Table will be removed in a future version of p5.js to make way for a new, friendlier version :)
|
|
2821
|
-
*
|
|
2822
|
-
*
|
|
2823
|
-
*
|
|
2824
|
-
*
|
|
2825
|
-
* <div><code>
|
|
2682
|
+
* @param {p5.Table} Table the <a href="#/p5.Table">Table</a> object to save to a file
|
|
2683
|
+
* @param {String} filename the filename to which the Table should be saved
|
|
2684
|
+
* @param {String} [options] can be one of "tsv", "csv", or "html"
|
|
2685
|
+
* @example
|
|
2826
2686
|
* let table;
|
|
2827
2687
|
*
|
|
2828
2688
|
* function setup() {
|
|
@@ -2846,7 +2706,6 @@ function files(p5, fn){
|
|
|
2846
2706
|
* // Saves the following to a file called 'new.csv':
|
|
2847
2707
|
* // id,species,name
|
|
2848
2708
|
* // 0,Panthera leo,Lion
|
|
2849
|
-
* </code></div>
|
|
2850
2709
|
*/
|
|
2851
2710
|
fn.saveTable = function (table, filename, options) {
|
|
2852
2711
|
// p5._validateParameters('saveTable', arguments);
|
|
@@ -3021,8 +2880,6 @@ function loadingDisplaying(p5, fn){
|
|
|
3021
2880
|
* @return {Promise<p5.Image>} the <a href="#/p5.Image">p5.Image</a> object.
|
|
3022
2881
|
*
|
|
3023
2882
|
* @example
|
|
3024
|
-
* <div>
|
|
3025
|
-
* <code>
|
|
3026
2883
|
* let img;
|
|
3027
2884
|
*
|
|
3028
2885
|
* // Load the image and create a p5.Image object.
|
|
@@ -3035,11 +2892,8 @@ function loadingDisplaying(p5, fn){
|
|
|
3035
2892
|
*
|
|
3036
2893
|
* describe('Image of the underside of a white umbrella and a gridded ceiling.');
|
|
3037
2894
|
* }
|
|
3038
|
-
* </code>
|
|
3039
|
-
* </div>
|
|
3040
2895
|
*
|
|
3041
|
-
*
|
|
3042
|
-
* <code>
|
|
2896
|
+
* @example
|
|
3043
2897
|
* async function setup() {
|
|
3044
2898
|
* // Call handleImage() once the image loads.
|
|
3045
2899
|
* await loadImage('assets/laDefense.jpg', handleImage);
|
|
@@ -3051,11 +2905,8 @@ function loadingDisplaying(p5, fn){
|
|
|
3051
2905
|
* function handleImage(img) {
|
|
3052
2906
|
* image(img, 0, 0);
|
|
3053
2907
|
* }
|
|
3054
|
-
* </code>
|
|
3055
|
-
* </div>
|
|
3056
2908
|
*
|
|
3057
|
-
*
|
|
3058
|
-
* <code>
|
|
2909
|
+
* @example
|
|
3059
2910
|
* async function setup() {
|
|
3060
2911
|
* // Call handleImage() once the image loads or
|
|
3061
2912
|
* // call handleError() if an error occurs.
|
|
@@ -3073,8 +2924,6 @@ function loadingDisplaying(p5, fn){
|
|
|
3073
2924
|
* function handleError(event) {
|
|
3074
2925
|
* console.error('Oops!', event);
|
|
3075
2926
|
* }
|
|
3076
|
-
* </code>
|
|
3077
|
-
* </div>
|
|
3078
2927
|
*/
|
|
3079
2928
|
fn.loadImage = async function(
|
|
3080
2929
|
path,
|
|
@@ -3164,8 +3013,6 @@ function loadingDisplaying(p5, fn){
|
|
|
3164
3013
|
* @param {String} [options.notificationID='progressBar'] The id to give to the notification's DOM element.
|
|
3165
3014
|
*
|
|
3166
3015
|
* @example
|
|
3167
|
-
* <div>
|
|
3168
|
-
* <code>
|
|
3169
3016
|
* function setup() {
|
|
3170
3017
|
* createCanvas(100, 100);
|
|
3171
3018
|
*
|
|
@@ -3189,11 +3036,8 @@ function loadingDisplaying(p5, fn){
|
|
|
3189
3036
|
* saveGif('mySketch', 5);
|
|
3190
3037
|
* }
|
|
3191
3038
|
* }
|
|
3192
|
-
* </code>
|
|
3193
|
-
* </div>
|
|
3194
3039
|
*
|
|
3195
|
-
*
|
|
3196
|
-
* <code>
|
|
3040
|
+
* @example
|
|
3197
3041
|
* function setup() {
|
|
3198
3042
|
* createCanvas(100, 100);
|
|
3199
3043
|
*
|
|
@@ -3218,8 +3062,6 @@ function loadingDisplaying(p5, fn){
|
|
|
3218
3062
|
* saveGif('mySketch', 5, { delay: 1 });
|
|
3219
3063
|
* }
|
|
3220
3064
|
* }
|
|
3221
|
-
* </code>
|
|
3222
|
-
* </div>
|
|
3223
3065
|
*/
|
|
3224
3066
|
fn.saveGif = async function(
|
|
3225
3067
|
fileName,
|
|
@@ -3247,7 +3089,7 @@ function loadingDisplaying(p5, fn){
|
|
|
3247
3089
|
const silent = (options && options.silent) || false;
|
|
3248
3090
|
const notificationDuration = (options && options.notificationDuration) || 0;
|
|
3249
3091
|
const notificationID = (options && options.notificationID) || 'progressBar';
|
|
3250
|
-
|
|
3092
|
+
const resetAnimation = (options && options.reset !== undefined) ? options.reset : true;
|
|
3251
3093
|
// if arguments in the options object are not correct, cancel operation
|
|
3252
3094
|
if (typeof delay !== 'number') {
|
|
3253
3095
|
throw TypeError('Delay parameter must be a number');
|
|
@@ -3302,7 +3144,7 @@ function loadingDisplaying(p5, fn){
|
|
|
3302
3144
|
// initialize variables for the frames processing
|
|
3303
3145
|
let frameIterator;
|
|
3304
3146
|
let totalNumberOfFrames;
|
|
3305
|
-
|
|
3147
|
+
|
|
3306
3148
|
if (resetAnimation) {
|
|
3307
3149
|
frameIterator = nFramesDelay;
|
|
3308
3150
|
this.frameCount = frameIterator;
|
|
@@ -3353,7 +3195,7 @@ function loadingDisplaying(p5, fn){
|
|
|
3353
3195
|
//
|
|
3354
3196
|
// Waiting on this empty promise means we'll continue as soon as setup
|
|
3355
3197
|
// finishes without waiting for another frame.
|
|
3356
|
-
|
|
3198
|
+
await new Promise(requestAnimationFrame);
|
|
3357
3199
|
|
|
3358
3200
|
while (frameIterator < totalNumberOfFrames) {
|
|
3359
3201
|
/*
|
|
@@ -3903,8 +3745,6 @@ function loadingDisplaying(p5, fn){
|
|
|
3903
3745
|
* @param {Number} [height] height to draw the image.
|
|
3904
3746
|
*
|
|
3905
3747
|
* @example
|
|
3906
|
-
* <div>
|
|
3907
|
-
* <code>
|
|
3908
3748
|
* let img;
|
|
3909
3749
|
*
|
|
3910
3750
|
* async function setup() {
|
|
@@ -3920,11 +3760,8 @@ function loadingDisplaying(p5, fn){
|
|
|
3920
3760
|
*
|
|
3921
3761
|
* describe('An image of the underside of a white umbrella with a gridded ceiling above. The image has dark gray borders on its left and top.');
|
|
3922
3762
|
* }
|
|
3923
|
-
* </code>
|
|
3924
|
-
* </div>
|
|
3925
3763
|
*
|
|
3926
|
-
*
|
|
3927
|
-
* <code>
|
|
3764
|
+
* @example
|
|
3928
3765
|
* let img;
|
|
3929
3766
|
*
|
|
3930
3767
|
* async function setup() {
|
|
@@ -3940,11 +3777,8 @@ function loadingDisplaying(p5, fn){
|
|
|
3940
3777
|
*
|
|
3941
3778
|
* describe('An image of the underside of a white umbrella with a gridded ceiling above. The image is drawn in the top left corner of a dark gray square.');
|
|
3942
3779
|
* }
|
|
3943
|
-
* </code>
|
|
3944
|
-
* </div>
|
|
3945
3780
|
*
|
|
3946
|
-
*
|
|
3947
|
-
* <code>
|
|
3781
|
+
* @example
|
|
3948
3782
|
* let img;
|
|
3949
3783
|
*
|
|
3950
3784
|
* async function setup() {
|
|
@@ -3960,11 +3794,8 @@ function loadingDisplaying(p5, fn){
|
|
|
3960
3794
|
*
|
|
3961
3795
|
* describe('An image of a gridded ceiling drawn in the center of a dark gray square.');
|
|
3962
3796
|
* }
|
|
3963
|
-
* </code>
|
|
3964
|
-
* </div>
|
|
3965
3797
|
*
|
|
3966
|
-
*
|
|
3967
|
-
* <code>
|
|
3798
|
+
* @example
|
|
3968
3799
|
* let img;
|
|
3969
3800
|
*
|
|
3970
3801
|
* async function setup() {
|
|
@@ -3979,11 +3810,8 @@ function loadingDisplaying(p5, fn){
|
|
|
3979
3810
|
*
|
|
3980
3811
|
* describe('An image of an astronaut on the moon. The top and bottom borders of the image are dark gray.');
|
|
3981
3812
|
* }
|
|
3982
|
-
* </code>
|
|
3983
|
-
* </div>
|
|
3984
3813
|
*
|
|
3985
|
-
*
|
|
3986
|
-
* <code>
|
|
3814
|
+
* @example
|
|
3987
3815
|
* let img;
|
|
3988
3816
|
*
|
|
3989
3817
|
* async function setup() {
|
|
@@ -3999,8 +3827,6 @@ function loadingDisplaying(p5, fn){
|
|
|
3999
3827
|
*
|
|
4000
3828
|
* describe('A pixelated image of the underside of a white umbrella with a gridded ceiling above.');
|
|
4001
3829
|
* }
|
|
4002
|
-
* </code>
|
|
4003
|
-
* </div>
|
|
4004
3830
|
*/
|
|
4005
3831
|
/**
|
|
4006
3832
|
* @method image
|
|
@@ -4150,8 +3976,6 @@ function loadingDisplaying(p5, fn){
|
|
|
4150
3976
|
* @param {Number} [alpha]
|
|
4151
3977
|
*
|
|
4152
3978
|
* @example
|
|
4153
|
-
* <div>
|
|
4154
|
-
* <code>
|
|
4155
3979
|
* let img;
|
|
4156
3980
|
*
|
|
4157
3981
|
* async function setup() {
|
|
@@ -4170,11 +3994,8 @@ function loadingDisplaying(p5, fn){
|
|
|
4170
3994
|
*
|
|
4171
3995
|
* describe('Two images of an umbrella and a ceiling side-by-side. The image on the right has a red tint.');
|
|
4172
3996
|
* }
|
|
4173
|
-
* </code>
|
|
4174
|
-
* </div>
|
|
4175
3997
|
*
|
|
4176
|
-
*
|
|
4177
|
-
* <code>
|
|
3998
|
+
* @example
|
|
4178
3999
|
* let img;
|
|
4179
4000
|
*
|
|
4180
4001
|
* async function setup() {
|
|
@@ -4193,11 +4014,8 @@ function loadingDisplaying(p5, fn){
|
|
|
4193
4014
|
*
|
|
4194
4015
|
* describe('Two images of an umbrella and a ceiling side-by-side. The image on the right has a red tint.');
|
|
4195
4016
|
* }
|
|
4196
|
-
* </code>
|
|
4197
|
-
* </div>
|
|
4198
4017
|
*
|
|
4199
|
-
*
|
|
4200
|
-
* <code>
|
|
4018
|
+
* @example
|
|
4201
4019
|
* let img;
|
|
4202
4020
|
*
|
|
4203
4021
|
* async function setup() {
|
|
@@ -4216,11 +4034,8 @@ function loadingDisplaying(p5, fn){
|
|
|
4216
4034
|
*
|
|
4217
4035
|
* describe('Two images of an umbrella and a ceiling side-by-side. The image on the right has a transparent red tint.');
|
|
4218
4036
|
* }
|
|
4219
|
-
* </code>
|
|
4220
|
-
* </div>
|
|
4221
4037
|
*
|
|
4222
|
-
*
|
|
4223
|
-
* <code>
|
|
4038
|
+
* @example
|
|
4224
4039
|
* let img;
|
|
4225
4040
|
*
|
|
4226
4041
|
* async function setup() {
|
|
@@ -4239,26 +4054,21 @@ function loadingDisplaying(p5, fn){
|
|
|
4239
4054
|
*
|
|
4240
4055
|
* describe('Two images of an umbrella and a ceiling side-by-side. The image on the right is transparent.');
|
|
4241
4056
|
* }
|
|
4242
|
-
* </code>
|
|
4243
|
-
* </div>
|
|
4244
4057
|
*/
|
|
4245
4058
|
/**
|
|
4246
4059
|
* @method tint
|
|
4247
4060
|
* @param {String} value CSS color string.
|
|
4248
4061
|
*/
|
|
4249
|
-
|
|
4250
4062
|
/**
|
|
4251
4063
|
* @method tint
|
|
4252
4064
|
* @param {Number} gray grayscale value.
|
|
4253
4065
|
* @param {Number} [alpha]
|
|
4254
4066
|
*/
|
|
4255
|
-
|
|
4256
4067
|
/**
|
|
4257
4068
|
* @method tint
|
|
4258
4069
|
* @param {Number[]} values array containing the red, green, blue &
|
|
4259
4070
|
* alpha components of the color.
|
|
4260
4071
|
*/
|
|
4261
|
-
|
|
4262
4072
|
/**
|
|
4263
4073
|
* @method tint
|
|
4264
4074
|
* @param {p5.Color} color the tint color
|
|
@@ -4277,8 +4087,6 @@ function loadingDisplaying(p5, fn){
|
|
|
4277
4087
|
* @method noTint
|
|
4278
4088
|
*
|
|
4279
4089
|
* @example
|
|
4280
|
-
* <div>
|
|
4281
|
-
* <code>
|
|
4282
4090
|
* let img;
|
|
4283
4091
|
*
|
|
4284
4092
|
* async function setup() {
|
|
@@ -4299,8 +4107,6 @@ function loadingDisplaying(p5, fn){
|
|
|
4299
4107
|
*
|
|
4300
4108
|
* describe('Two images of an umbrella and a ceiling side-by-side. The image on the left has a red tint.');
|
|
4301
4109
|
* }
|
|
4302
|
-
* </code>
|
|
4303
|
-
* </div>
|
|
4304
4110
|
*/
|
|
4305
4111
|
fn.noTint = function() {
|
|
4306
4112
|
this._renderer.states.setValue('tint', null);
|
|
@@ -4339,9 +4145,6 @@ function loadingDisplaying(p5, fn){
|
|
|
4339
4145
|
* @param {(CORNER|CORNERS|CENTER)} mode either CORNER, CORNERS, or CENTER.
|
|
4340
4146
|
*
|
|
4341
4147
|
* @example
|
|
4342
|
-
*
|
|
4343
|
-
* <div>
|
|
4344
|
-
* <code>
|
|
4345
4148
|
* let img;
|
|
4346
4149
|
*
|
|
4347
4150
|
* async function setup() {
|
|
@@ -4360,11 +4163,8 @@ function loadingDisplaying(p5, fn){
|
|
|
4360
4163
|
*
|
|
4361
4164
|
* describe('A square image of a brick wall is drawn at the top left of a gray square.');
|
|
4362
4165
|
* }
|
|
4363
|
-
* </code>
|
|
4364
|
-
* </div>
|
|
4365
4166
|
*
|
|
4366
|
-
*
|
|
4367
|
-
* <code>
|
|
4167
|
+
* @example
|
|
4368
4168
|
* let img;
|
|
4369
4169
|
*
|
|
4370
4170
|
* async function setup() {
|
|
@@ -4383,11 +4183,8 @@ function loadingDisplaying(p5, fn){
|
|
|
4383
4183
|
*
|
|
4384
4184
|
* describe('An image of a brick wall is drawn on a gray square. The image is squeezed into a small rectangular area.');
|
|
4385
4185
|
* }
|
|
4386
|
-
* </code>
|
|
4387
|
-
* </div>
|
|
4388
4186
|
*
|
|
4389
|
-
*
|
|
4390
|
-
* <code>
|
|
4187
|
+
* @example
|
|
4391
4188
|
* let img;
|
|
4392
4189
|
*
|
|
4393
4190
|
* async function setup() {
|
|
@@ -4406,8 +4203,6 @@ function loadingDisplaying(p5, fn){
|
|
|
4406
4203
|
*
|
|
4407
4204
|
* describe('A square image of a brick wall is drawn on a gray square.');
|
|
4408
4205
|
* }
|
|
4409
|
-
* </code>
|
|
4410
|
-
* </div>
|
|
4411
4206
|
*/
|
|
4412
4207
|
fn.imageMode = function(m) {
|
|
4413
4208
|
// p5._validateParameters('imageMode', arguments);
|
|
@@ -4502,8 +4297,6 @@ class Camera {
|
|
|
4502
4297
|
* Defaults to `10 * 800`.
|
|
4503
4298
|
*
|
|
4504
4299
|
* @example
|
|
4505
|
-
* <div>
|
|
4506
|
-
* <code>
|
|
4507
4300
|
* // Double-click to toggle between cameras.
|
|
4508
4301
|
*
|
|
4509
4302
|
* let cam1;
|
|
@@ -4552,11 +4345,8 @@ class Camera {
|
|
|
4552
4345
|
* isDefaultCamera = true;
|
|
4553
4346
|
* }
|
|
4554
4347
|
* }
|
|
4555
|
-
* </code>
|
|
4556
|
-
* </div>
|
|
4557
4348
|
*
|
|
4558
|
-
*
|
|
4559
|
-
* <code>
|
|
4349
|
+
* @example
|
|
4560
4350
|
* // Double-click to toggle between cameras.
|
|
4561
4351
|
*
|
|
4562
4352
|
* let cam1;
|
|
@@ -4609,8 +4399,6 @@ class Camera {
|
|
|
4609
4399
|
* isDefaultCamera = true;
|
|
4610
4400
|
* }
|
|
4611
4401
|
* }
|
|
4612
|
-
* </code>
|
|
4613
|
-
* </div>
|
|
4614
4402
|
*/
|
|
4615
4403
|
perspective(fovy, aspect, near, far) {
|
|
4616
4404
|
const range = this._renderer.zClipRange();
|
|
@@ -4715,8 +4503,6 @@ class Camera {
|
|
|
4715
4503
|
* @param {Number} [far] z-coordinate of the frustum’s far plane. Defaults to `max(width, height) + 800`.
|
|
4716
4504
|
*
|
|
4717
4505
|
* @example
|
|
4718
|
-
* <div>
|
|
4719
|
-
* <code>
|
|
4720
4506
|
* // Double-click to toggle between cameras.
|
|
4721
4507
|
*
|
|
4722
4508
|
* let cam1;
|
|
@@ -4769,11 +4555,8 @@ class Camera {
|
|
|
4769
4555
|
* isDefaultCamera = true;
|
|
4770
4556
|
* }
|
|
4771
4557
|
* }
|
|
4772
|
-
* </code>
|
|
4773
|
-
* </div>
|
|
4774
4558
|
*
|
|
4775
|
-
*
|
|
4776
|
-
* <code>
|
|
4559
|
+
* @example
|
|
4777
4560
|
* // Double-click to toggle between cameras.
|
|
4778
4561
|
*
|
|
4779
4562
|
* let cam1;
|
|
@@ -4833,8 +4616,6 @@ class Camera {
|
|
|
4833
4616
|
* isDefaultCamera = true;
|
|
4834
4617
|
* }
|
|
4835
4618
|
* }
|
|
4836
|
-
* </code>
|
|
4837
|
-
* </div>
|
|
4838
4619
|
*/
|
|
4839
4620
|
ortho(left, right, bottom, top, near, far) {
|
|
4840
4621
|
const source = this.fbo || this._renderer;
|
|
@@ -4906,8 +4687,6 @@ class Camera {
|
|
|
4906
4687
|
* @param {Number} [far] z-coordinate of the frustum’s far plane. Defaults to `10 * 800`.
|
|
4907
4688
|
*
|
|
4908
4689
|
* @example
|
|
4909
|
-
* <div>
|
|
4910
|
-
* <code>
|
|
4911
4690
|
* // Double-click to toggle between cameras.
|
|
4912
4691
|
*
|
|
4913
4692
|
* let cam1;
|
|
@@ -4966,8 +4745,6 @@ class Camera {
|
|
|
4966
4745
|
* isDefaultCamera = true;
|
|
4967
4746
|
* }
|
|
4968
4747
|
* }
|
|
4969
|
-
* </code>
|
|
4970
|
-
* </div>
|
|
4971
4748
|
*/
|
|
4972
4749
|
frustum(left, right, bottom, top, near, far) {
|
|
4973
4750
|
if (left === undefined) left = -this._renderer.width * 0.05;
|
|
@@ -5073,8 +4850,6 @@ class Camera {
|
|
|
5073
4850
|
* @param {Number} angle amount to rotate camera in current
|
|
5074
4851
|
* <a href="#/p5/angleMode">angleMode</a> units.
|
|
5075
4852
|
* @example
|
|
5076
|
-
* <div>
|
|
5077
|
-
* <code>
|
|
5078
4853
|
* let cam;
|
|
5079
4854
|
* let delta = 0.01;
|
|
5080
4855
|
*
|
|
@@ -5109,8 +4884,6 @@ class Camera {
|
|
|
5109
4884
|
* translate(0, 30, 0);
|
|
5110
4885
|
* box(20);
|
|
5111
4886
|
* }
|
|
5112
|
-
* </code>
|
|
5113
|
-
* </div>
|
|
5114
4887
|
*
|
|
5115
4888
|
* @alt
|
|
5116
4889
|
* camera view rotates in counter clockwise direction with vertically stacked boxes in front of it.
|
|
@@ -5154,8 +4927,6 @@ class Camera {
|
|
|
5154
4927
|
* <a href="#/p5/angleMode">angleMode()</a>.
|
|
5155
4928
|
*
|
|
5156
4929
|
* @example
|
|
5157
|
-
* <div>
|
|
5158
|
-
* <code>
|
|
5159
4930
|
* let cam;
|
|
5160
4931
|
* let delta = 0.001;
|
|
5161
4932
|
*
|
|
@@ -5193,8 +4964,6 @@ class Camera {
|
|
|
5193
4964
|
* // Draw the box.
|
|
5194
4965
|
* box();
|
|
5195
4966
|
* }
|
|
5196
|
-
* </code>
|
|
5197
|
-
* </div>
|
|
5198
4967
|
*/
|
|
5199
4968
|
pan(amount) {
|
|
5200
4969
|
const local = this._getLocalAxes();
|
|
@@ -5219,8 +4988,6 @@ class Camera {
|
|
|
5219
4988
|
* <a href="#/p5/angleMode">angleMode()</a>.
|
|
5220
4989
|
*
|
|
5221
4990
|
* @example
|
|
5222
|
-
* <div>
|
|
5223
|
-
* <code>
|
|
5224
4991
|
* let cam;
|
|
5225
4992
|
* let delta = 0.001;
|
|
5226
4993
|
*
|
|
@@ -5258,8 +5025,6 @@ class Camera {
|
|
|
5258
5025
|
* // Draw the box.
|
|
5259
5026
|
* box();
|
|
5260
5027
|
* }
|
|
5261
|
-
* </code>
|
|
5262
|
-
* </div>
|
|
5263
5028
|
*/
|
|
5264
5029
|
tilt(amount) {
|
|
5265
5030
|
const local = this._getLocalAxes();
|
|
@@ -5283,8 +5048,6 @@ class Camera {
|
|
|
5283
5048
|
* @param {Number} z z-coordinate of the position where the camera should look in "world" space.
|
|
5284
5049
|
*
|
|
5285
5050
|
* @example
|
|
5286
|
-
* <div>
|
|
5287
|
-
* <code>
|
|
5288
5051
|
* // Double-click to look at a different cube.
|
|
5289
5052
|
*
|
|
5290
5053
|
* let cam;
|
|
@@ -5344,8 +5107,6 @@ class Camera {
|
|
|
5344
5107
|
* isLookingLeft = true;
|
|
5345
5108
|
* }
|
|
5346
5109
|
* }
|
|
5347
|
-
* </code>
|
|
5348
|
-
* </div>
|
|
5349
5110
|
*/
|
|
5350
5111
|
lookAt(x, y, z) {
|
|
5351
5112
|
this.camera(
|
|
@@ -5402,8 +5163,6 @@ class Camera {
|
|
|
5402
5163
|
* @param {Number} [upZ] z-component of the camera’s "up" vector. Defaults to 0.
|
|
5403
5164
|
*
|
|
5404
5165
|
* @example
|
|
5405
|
-
* <div>
|
|
5406
|
-
* <code>
|
|
5407
5166
|
* // Double-click to toggle between cameras.
|
|
5408
5167
|
*
|
|
5409
5168
|
* let cam1;
|
|
@@ -5460,11 +5219,8 @@ class Camera {
|
|
|
5460
5219
|
* isDefaultCamera = true;
|
|
5461
5220
|
* }
|
|
5462
5221
|
* }
|
|
5463
|
-
* </code>
|
|
5464
|
-
* </div>
|
|
5465
5222
|
*
|
|
5466
|
-
*
|
|
5467
|
-
* <code>
|
|
5223
|
+
* @example
|
|
5468
5224
|
* // Double-click to toggle between cameras.
|
|
5469
5225
|
*
|
|
5470
5226
|
* let cam1;
|
|
@@ -5526,8 +5282,6 @@ class Camera {
|
|
|
5526
5282
|
* isDefaultCamera = true;
|
|
5527
5283
|
* }
|
|
5528
5284
|
* }
|
|
5529
|
-
* </code>
|
|
5530
|
-
* </div>
|
|
5531
5285
|
*/
|
|
5532
5286
|
camera(
|
|
5533
5287
|
eyeX,
|
|
@@ -5605,8 +5359,6 @@ class Camera {
|
|
|
5605
5359
|
* @param {Number} y distance to move along the camera’s "local" y-axis.
|
|
5606
5360
|
* @param {Number} z distance to move along the camera’s "local" z-axis.
|
|
5607
5361
|
* @example
|
|
5608
|
-
* <div>
|
|
5609
|
-
* <code>
|
|
5610
5362
|
* // Click the canvas to begin detecting key presses.
|
|
5611
5363
|
*
|
|
5612
5364
|
* let cam;
|
|
@@ -5665,8 +5417,6 @@ class Camera {
|
|
|
5665
5417
|
* // Draw the box.
|
|
5666
5418
|
* box();
|
|
5667
5419
|
* }
|
|
5668
|
-
* </code>
|
|
5669
|
-
* </div>
|
|
5670
5420
|
*/
|
|
5671
5421
|
move(x, y, z) {
|
|
5672
5422
|
const local = this._getLocalAxes();
|
|
@@ -5703,8 +5453,6 @@ class Camera {
|
|
|
5703
5453
|
* @param {Number} z z-coordinate in "world" space.
|
|
5704
5454
|
*
|
|
5705
5455
|
* @example
|
|
5706
|
-
* <div>
|
|
5707
|
-
* <code>
|
|
5708
5456
|
* // Double-click to toggle between cameras.
|
|
5709
5457
|
*
|
|
5710
5458
|
* let cam1;
|
|
@@ -5759,11 +5507,8 @@ class Camera {
|
|
|
5759
5507
|
* isDefaultCamera = true;
|
|
5760
5508
|
* }
|
|
5761
5509
|
* }
|
|
5762
|
-
* </code>
|
|
5763
|
-
* </div>
|
|
5764
5510
|
*
|
|
5765
|
-
*
|
|
5766
|
-
* <code>
|
|
5511
|
+
* @example
|
|
5767
5512
|
* // Double-click to toggle between cameras.
|
|
5768
5513
|
*
|
|
5769
5514
|
* let cam1;
|
|
@@ -5822,8 +5567,6 @@ class Camera {
|
|
|
5822
5567
|
* isDefaultCamera = true;
|
|
5823
5568
|
* }
|
|
5824
5569
|
* }
|
|
5825
|
-
* </code>
|
|
5826
|
-
* </div>
|
|
5827
5570
|
*/
|
|
5828
5571
|
setPosition(x, y, z) {
|
|
5829
5572
|
const diffX = x - this.eyeX;
|
|
@@ -5853,8 +5596,6 @@ class Camera {
|
|
|
5853
5596
|
* @param {p5.Camera} cam camera to copy.
|
|
5854
5597
|
*
|
|
5855
5598
|
* @example
|
|
5856
|
-
* <div>
|
|
5857
|
-
* <code>
|
|
5858
5599
|
* // Double-click to "reset" the camera zoom.
|
|
5859
5600
|
*
|
|
5860
5601
|
* let cam1;
|
|
@@ -5953,8 +5694,6 @@ class Camera {
|
|
|
5953
5694
|
* @param {Number} amt amount of interpolation between 0.0 (`cam0`) and 1.0 (`cam1`).
|
|
5954
5695
|
*
|
|
5955
5696
|
* @example
|
|
5956
|
-
* <div>
|
|
5957
|
-
* <code>
|
|
5958
5697
|
* let cam;
|
|
5959
5698
|
* let cam0;
|
|
5960
5699
|
* let cam1;
|
|
@@ -5996,8 +5735,6 @@ class Camera {
|
|
|
5996
5735
|
*
|
|
5997
5736
|
* box();
|
|
5998
5737
|
* }
|
|
5999
|
-
* </code>
|
|
6000
|
-
* </div>
|
|
6001
5738
|
*/
|
|
6002
5739
|
slerp(cam0, cam1, amt) {
|
|
6003
5740
|
// If t is 0 or 1, do not interpolate and set the argument camera.
|
|
@@ -6542,8 +6279,6 @@ function camera(p5, fn){
|
|
|
6542
6279
|
* @chainable
|
|
6543
6280
|
*
|
|
6544
6281
|
* @example
|
|
6545
|
-
* <div>
|
|
6546
|
-
* <code>
|
|
6547
6282
|
* function setup() {
|
|
6548
6283
|
* createCanvas(100, 100, WEBGL);
|
|
6549
6284
|
*
|
|
@@ -6559,11 +6294,8 @@ function camera(p5, fn){
|
|
|
6559
6294
|
* // Draw the box.
|
|
6560
6295
|
* box();
|
|
6561
6296
|
* }
|
|
6562
|
-
* </code>
|
|
6563
|
-
* </div>
|
|
6564
6297
|
*
|
|
6565
|
-
*
|
|
6566
|
-
* <code>
|
|
6298
|
+
* @example
|
|
6567
6299
|
* function setup() {
|
|
6568
6300
|
* createCanvas(100, 100, WEBGL);
|
|
6569
6301
|
*
|
|
@@ -6582,11 +6314,8 @@ function camera(p5, fn){
|
|
|
6582
6314
|
* // Draw the box.
|
|
6583
6315
|
* box();
|
|
6584
6316
|
* }
|
|
6585
|
-
* </code>
|
|
6586
|
-
* </div>
|
|
6587
6317
|
*
|
|
6588
|
-
*
|
|
6589
|
-
* <code>
|
|
6318
|
+
* @example
|
|
6590
6319
|
* // Adjust the range sliders to change the camera's position.
|
|
6591
6320
|
*
|
|
6592
6321
|
* let xSlider;
|
|
@@ -6626,8 +6355,6 @@ function camera(p5, fn){
|
|
|
6626
6355
|
* // Draw the box.
|
|
6627
6356
|
* box();
|
|
6628
6357
|
* }
|
|
6629
|
-
* </code>
|
|
6630
|
-
* </div>
|
|
6631
6358
|
*/
|
|
6632
6359
|
fn.camera = function (...args) {
|
|
6633
6360
|
this._assert3d('camera');
|
|
@@ -6693,8 +6420,6 @@ function camera(p5, fn){
|
|
|
6693
6420
|
* @chainable
|
|
6694
6421
|
*
|
|
6695
6422
|
* @example
|
|
6696
|
-
* <div>
|
|
6697
|
-
* <code>
|
|
6698
6423
|
* // Double-click to squeeze the box.
|
|
6699
6424
|
*
|
|
6700
6425
|
* let isSqueezed = false;
|
|
@@ -6725,11 +6450,8 @@ function camera(p5, fn){
|
|
|
6725
6450
|
* function doubleClicked() {
|
|
6726
6451
|
* isSqueezed = true;
|
|
6727
6452
|
* }
|
|
6728
|
-
* </code>
|
|
6729
|
-
* </div>
|
|
6730
6453
|
*
|
|
6731
|
-
*
|
|
6732
|
-
* <code>
|
|
6454
|
+
* @example
|
|
6733
6455
|
* function setup() {
|
|
6734
6456
|
* createCanvas(100, 100, WEBGL);
|
|
6735
6457
|
*
|
|
@@ -6757,8 +6479,6 @@ function camera(p5, fn){
|
|
|
6757
6479
|
* // Draw the box.
|
|
6758
6480
|
* box();
|
|
6759
6481
|
* }
|
|
6760
|
-
* </code>
|
|
6761
|
-
* </div>
|
|
6762
6482
|
*/
|
|
6763
6483
|
fn.perspective = function (...args) {
|
|
6764
6484
|
this._assert3d('perspective');
|
|
@@ -6767,7 +6487,6 @@ function camera(p5, fn){
|
|
|
6767
6487
|
return this;
|
|
6768
6488
|
};
|
|
6769
6489
|
|
|
6770
|
-
|
|
6771
6490
|
/**
|
|
6772
6491
|
* Enables or disables perspective for lines in 3D sketches.
|
|
6773
6492
|
*
|
|
@@ -6803,8 +6522,6 @@ function camera(p5, fn){
|
|
|
6803
6522
|
* @param {Boolean} enable whether to enable line perspective.
|
|
6804
6523
|
*
|
|
6805
6524
|
* @example
|
|
6806
|
-
* <div>
|
|
6807
|
-
* <code>
|
|
6808
6525
|
* // Double-click the canvas to toggle the line perspective.
|
|
6809
6526
|
*
|
|
6810
6527
|
* function setup() {
|
|
@@ -6837,11 +6554,8 @@ function camera(p5, fn){
|
|
|
6837
6554
|
* let isEnabled = linePerspective();
|
|
6838
6555
|
* linePerspective(!isEnabled);
|
|
6839
6556
|
* }
|
|
6840
|
-
* </code>
|
|
6841
|
-
* </div>
|
|
6842
6557
|
*
|
|
6843
|
-
*
|
|
6844
|
-
* <code>
|
|
6558
|
+
* @example
|
|
6845
6559
|
* // Double-click the canvas to toggle the line perspective.
|
|
6846
6560
|
*
|
|
6847
6561
|
* function setup() {
|
|
@@ -6877,8 +6591,6 @@ function camera(p5, fn){
|
|
|
6877
6591
|
* let isEnabled = linePerspective();
|
|
6878
6592
|
* linePerspective(!isEnabled);
|
|
6879
6593
|
* }
|
|
6880
|
-
* </code>
|
|
6881
|
-
* </div>
|
|
6882
6594
|
*/
|
|
6883
6595
|
/**
|
|
6884
6596
|
* @method linePerspective
|
|
@@ -6932,8 +6644,6 @@ function camera(p5, fn){
|
|
|
6932
6644
|
* @chainable
|
|
6933
6645
|
*
|
|
6934
6646
|
* @example
|
|
6935
|
-
* <div>
|
|
6936
|
-
* <code>
|
|
6937
6647
|
* function setup() {
|
|
6938
6648
|
* createCanvas(100, 100, WEBGL);
|
|
6939
6649
|
*
|
|
@@ -6959,11 +6669,8 @@ function camera(p5, fn){
|
|
|
6959
6669
|
* box(10);
|
|
6960
6670
|
* }
|
|
6961
6671
|
* }
|
|
6962
|
-
* </code>
|
|
6963
|
-
* </div>
|
|
6964
6672
|
*
|
|
6965
|
-
*
|
|
6966
|
-
* <code>
|
|
6673
|
+
* @example
|
|
6967
6674
|
* function setup() {
|
|
6968
6675
|
* createCanvas(100, 100, WEBGL);
|
|
6969
6676
|
*
|
|
@@ -6993,8 +6700,6 @@ function camera(p5, fn){
|
|
|
6993
6700
|
* box(10);
|
|
6994
6701
|
* }
|
|
6995
6702
|
* }
|
|
6996
|
-
* </code>
|
|
6997
|
-
* </div>
|
|
6998
6703
|
*/
|
|
6999
6704
|
fn.ortho = function (...args) {
|
|
7000
6705
|
this._assert3d('ortho');
|
|
@@ -7045,8 +6750,6 @@ function camera(p5, fn){
|
|
|
7045
6750
|
* @chainable
|
|
7046
6751
|
*
|
|
7047
6752
|
* @example
|
|
7048
|
-
* <div>
|
|
7049
|
-
* <code>
|
|
7050
6753
|
* function setup() {
|
|
7051
6754
|
* createCanvas(100, 100, WEBGL);
|
|
7052
6755
|
*
|
|
@@ -7072,11 +6775,8 @@ function camera(p5, fn){
|
|
|
7072
6775
|
* box(10);
|
|
7073
6776
|
* }
|
|
7074
6777
|
* }
|
|
7075
|
-
* </code>
|
|
7076
|
-
* </div>
|
|
7077
6778
|
*
|
|
7078
|
-
*
|
|
7079
|
-
* <code>
|
|
6779
|
+
* @example
|
|
7080
6780
|
* function setup() {
|
|
7081
6781
|
* createCanvas(100, 100, WEBGL);
|
|
7082
6782
|
* describe('A white cube on a gray background.');
|
|
@@ -7105,8 +6805,6 @@ function camera(p5, fn){
|
|
|
7105
6805
|
* box(10);
|
|
7106
6806
|
* }
|
|
7107
6807
|
* }
|
|
7108
|
-
* </code>
|
|
7109
|
-
* </div>
|
|
7110
6808
|
*/
|
|
7111
6809
|
fn.frustum = function (...args) {
|
|
7112
6810
|
this._assert3d('frustum');
|
|
@@ -7137,8 +6835,6 @@ function camera(p5, fn){
|
|
|
7137
6835
|
* @for p5
|
|
7138
6836
|
*
|
|
7139
6837
|
* @example
|
|
7140
|
-
* <div>
|
|
7141
|
-
* <code>
|
|
7142
6838
|
* // Double-click to toggle between cameras.
|
|
7143
6839
|
*
|
|
7144
6840
|
* let cam1;
|
|
@@ -7182,8 +6878,6 @@ function camera(p5, fn){
|
|
|
7182
6878
|
* usingCam1 = true;
|
|
7183
6879
|
* }
|
|
7184
6880
|
* }
|
|
7185
|
-
* </code>
|
|
7186
|
-
* </div>
|
|
7187
6881
|
*/
|
|
7188
6882
|
fn.createCamera = function () {
|
|
7189
6883
|
this._assert3d('createCamera');
|
|
@@ -7204,8 +6898,6 @@ function camera(p5, fn){
|
|
|
7204
6898
|
* @for p5
|
|
7205
6899
|
*
|
|
7206
6900
|
* @example
|
|
7207
|
-
* <div>
|
|
7208
|
-
* <code>
|
|
7209
6901
|
* // Double-click to toggle between cameras.
|
|
7210
6902
|
*
|
|
7211
6903
|
* let cam1;
|
|
@@ -7249,8 +6941,6 @@ function camera(p5, fn){
|
|
|
7249
6941
|
* usingCam1 = true;
|
|
7250
6942
|
* }
|
|
7251
6943
|
* }
|
|
7252
|
-
* </code>
|
|
7253
|
-
* </div>
|
|
7254
6944
|
*/
|
|
7255
6945
|
fn.setCamera = function (cam) {
|
|
7256
6946
|
this._renderer.setCamera(cam);
|
|
@@ -7285,8 +6975,6 @@ function camera(p5, fn){
|
|
|
7285
6975
|
* @param {RendererGL} rendererGL instance of WebGL renderer
|
|
7286
6976
|
*
|
|
7287
6977
|
* @example
|
|
7288
|
-
* <div>
|
|
7289
|
-
* <code>
|
|
7290
6978
|
* let cam;
|
|
7291
6979
|
* let delta = 0.001;
|
|
7292
6980
|
*
|
|
@@ -7324,11 +7012,8 @@ function camera(p5, fn){
|
|
|
7324
7012
|
* // Draw the box.
|
|
7325
7013
|
* box();
|
|
7326
7014
|
* }
|
|
7327
|
-
* </code>
|
|
7328
|
-
* </div>
|
|
7329
7015
|
*
|
|
7330
|
-
*
|
|
7331
|
-
* <code>
|
|
7016
|
+
* @example
|
|
7332
7017
|
* // Double-click to toggle between cameras.
|
|
7333
7018
|
*
|
|
7334
7019
|
* let cam1;
|
|
@@ -7374,8 +7059,6 @@ function camera(p5, fn){
|
|
|
7374
7059
|
* isDefaultCamera = true;
|
|
7375
7060
|
* }
|
|
7376
7061
|
* }
|
|
7377
|
-
* </code>
|
|
7378
|
-
* </div>
|
|
7379
7062
|
*/
|
|
7380
7063
|
p5.Camera = Camera;
|
|
7381
7064
|
|
|
@@ -7439,8 +7122,6 @@ function camera(p5, fn){
|
|
|
7439
7122
|
* @readonly
|
|
7440
7123
|
*
|
|
7441
7124
|
* @example
|
|
7442
|
-
* <div>
|
|
7443
|
-
* <code>
|
|
7444
7125
|
* let cam;
|
|
7445
7126
|
* let font;
|
|
7446
7127
|
*
|
|
@@ -7484,11 +7165,8 @@ function camera(p5, fn){
|
|
|
7484
7165
|
* // Display the value of eyeX, rounded to the nearest integer.
|
|
7485
7166
|
* text(`eyeX: ${round(cam.eyeX)}`, 0, 45);
|
|
7486
7167
|
* }
|
|
7487
|
-
* </code>
|
|
7488
|
-
* </div>
|
|
7489
7168
|
*
|
|
7490
|
-
*
|
|
7491
|
-
* <code>
|
|
7169
|
+
* @example
|
|
7492
7170
|
* let cam;
|
|
7493
7171
|
* let font;
|
|
7494
7172
|
*
|
|
@@ -7535,8 +7213,6 @@ function camera(p5, fn){
|
|
|
7535
7213
|
* // Display the value of eyeX, rounded to the nearest integer.
|
|
7536
7214
|
* text(`eyeX: ${round(cam.eyeX)}`, 0, 45);
|
|
7537
7215
|
* }
|
|
7538
|
-
* </code>
|
|
7539
|
-
* </div>
|
|
7540
7216
|
*/
|
|
7541
7217
|
|
|
7542
7218
|
/**
|
|
@@ -7549,8 +7225,6 @@ function camera(p5, fn){
|
|
|
7549
7225
|
* @readonly
|
|
7550
7226
|
*
|
|
7551
7227
|
* @example
|
|
7552
|
-
* <div>
|
|
7553
|
-
* <code>
|
|
7554
7228
|
* let cam;
|
|
7555
7229
|
* let font;
|
|
7556
7230
|
*
|
|
@@ -7594,11 +7268,8 @@ function camera(p5, fn){
|
|
|
7594
7268
|
* // Display the value of eyeY, rounded to the nearest integer.
|
|
7595
7269
|
* text(`eyeY: ${round(cam.eyeY)}`, 0, 45);
|
|
7596
7270
|
* }
|
|
7597
|
-
* </code>
|
|
7598
|
-
* </div>
|
|
7599
7271
|
*
|
|
7600
|
-
*
|
|
7601
|
-
* <code>
|
|
7272
|
+
* @example
|
|
7602
7273
|
* let cam;
|
|
7603
7274
|
* let font;
|
|
7604
7275
|
*
|
|
@@ -7648,8 +7319,6 @@ function camera(p5, fn){
|
|
|
7648
7319
|
* // Display the value of eyeY, rounded to the nearest integer.
|
|
7649
7320
|
* text(`eyeY: ${round(cam.eyeY)}`, 0, 45);
|
|
7650
7321
|
* }
|
|
7651
|
-
* </code>
|
|
7652
|
-
* </div>
|
|
7653
7322
|
*/
|
|
7654
7323
|
|
|
7655
7324
|
/**
|
|
@@ -7662,8 +7331,6 @@ function camera(p5, fn){
|
|
|
7662
7331
|
* @readonly
|
|
7663
7332
|
*
|
|
7664
7333
|
* @example
|
|
7665
|
-
* <div>
|
|
7666
|
-
* <code>
|
|
7667
7334
|
* let cam;
|
|
7668
7335
|
* let font;
|
|
7669
7336
|
*
|
|
@@ -7707,11 +7374,8 @@ function camera(p5, fn){
|
|
|
7707
7374
|
* // Display the value of eyeZ, rounded to the nearest integer.
|
|
7708
7375
|
* text(`eyeZ: ${round(cam.eyeZ)}`, 0, 45);
|
|
7709
7376
|
* }
|
|
7710
|
-
* </code>
|
|
7711
|
-
* </div>
|
|
7712
7377
|
*
|
|
7713
|
-
*
|
|
7714
|
-
* <code>
|
|
7378
|
+
* @example
|
|
7715
7379
|
* let cam;
|
|
7716
7380
|
* let font;
|
|
7717
7381
|
*
|
|
@@ -7761,8 +7425,6 @@ function camera(p5, fn){
|
|
|
7761
7425
|
* // Display the value of eyeZ, rounded to the nearest integer.
|
|
7762
7426
|
* text(`eyeZ: ${round(cam.eyeZ)}`, 0, 45);
|
|
7763
7427
|
* }
|
|
7764
|
-
* </code>
|
|
7765
|
-
* </div>
|
|
7766
7428
|
*/
|
|
7767
7429
|
|
|
7768
7430
|
/**
|
|
@@ -7776,8 +7438,6 @@ function camera(p5, fn){
|
|
|
7776
7438
|
* @readonly
|
|
7777
7439
|
*
|
|
7778
7440
|
* @example
|
|
7779
|
-
* <div>
|
|
7780
|
-
* <code>
|
|
7781
7441
|
* let cam;
|
|
7782
7442
|
* let font;
|
|
7783
7443
|
*
|
|
@@ -7821,11 +7481,8 @@ function camera(p5, fn){
|
|
|
7821
7481
|
* // Display the value of centerX, rounded to the nearest integer.
|
|
7822
7482
|
* text(`centerX: ${round(cam.centerX)}`, 0, 45);
|
|
7823
7483
|
* }
|
|
7824
|
-
* </code>
|
|
7825
|
-
* </div>
|
|
7826
7484
|
*
|
|
7827
|
-
*
|
|
7828
|
-
* <code>
|
|
7485
|
+
* @example
|
|
7829
7486
|
* let cam;
|
|
7830
7487
|
* let font;
|
|
7831
7488
|
*
|
|
@@ -7875,8 +7532,6 @@ function camera(p5, fn){
|
|
|
7875
7532
|
* // Display the value of centerX, rounded to the nearest integer.
|
|
7876
7533
|
* text(`centerX: ${round(cam.centerX)}`, 0, 45);
|
|
7877
7534
|
* }
|
|
7878
|
-
* </code>
|
|
7879
|
-
* </div>
|
|
7880
7535
|
*/
|
|
7881
7536
|
|
|
7882
7537
|
/**
|
|
@@ -7890,8 +7545,6 @@ function camera(p5, fn){
|
|
|
7890
7545
|
* @readonly
|
|
7891
7546
|
*
|
|
7892
7547
|
* @example
|
|
7893
|
-
* <div>
|
|
7894
|
-
* <code>
|
|
7895
7548
|
* let cam;
|
|
7896
7549
|
* let font;
|
|
7897
7550
|
*
|
|
@@ -7935,11 +7588,8 @@ function camera(p5, fn){
|
|
|
7935
7588
|
* // Display the value of centerY, rounded to the nearest integer.
|
|
7936
7589
|
* text(`centerY: ${round(cam.centerY)}`, 0, 45);
|
|
7937
7590
|
* }
|
|
7938
|
-
* </code>
|
|
7939
|
-
* </div>
|
|
7940
7591
|
*
|
|
7941
|
-
*
|
|
7942
|
-
* <code>
|
|
7592
|
+
* @example
|
|
7943
7593
|
* let cam;
|
|
7944
7594
|
* let font;
|
|
7945
7595
|
*
|
|
@@ -7989,8 +7639,6 @@ function camera(p5, fn){
|
|
|
7989
7639
|
* // Display the value of centerY, rounded to the nearest integer.
|
|
7990
7640
|
* text(`centerY: ${round(cam.centerY)}`, 0, 45);
|
|
7991
7641
|
* }
|
|
7992
|
-
* </code>
|
|
7993
|
-
* </div>
|
|
7994
7642
|
*/
|
|
7995
7643
|
|
|
7996
7644
|
/**
|
|
@@ -8004,8 +7652,6 @@ function camera(p5, fn){
|
|
|
8004
7652
|
* @readonly
|
|
8005
7653
|
*
|
|
8006
7654
|
* @example
|
|
8007
|
-
* <div>
|
|
8008
|
-
* <code>
|
|
8009
7655
|
* let cam;
|
|
8010
7656
|
* let font;
|
|
8011
7657
|
*
|
|
@@ -8049,11 +7695,8 @@ function camera(p5, fn){
|
|
|
8049
7695
|
* // Display the value of centerZ, rounded to the nearest integer.
|
|
8050
7696
|
* text(`centerZ: ${round(cam.centerZ)}`, 0, 45);
|
|
8051
7697
|
* }
|
|
8052
|
-
* </code>
|
|
8053
|
-
* </div>
|
|
8054
7698
|
*
|
|
8055
|
-
*
|
|
8056
|
-
* <code>
|
|
7699
|
+
* @example
|
|
8057
7700
|
* let cam;
|
|
8058
7701
|
* let font;
|
|
8059
7702
|
*
|
|
@@ -8100,8 +7743,6 @@ function camera(p5, fn){
|
|
|
8100
7743
|
* // Display the value of centerZ, rounded to the nearest integer.
|
|
8101
7744
|
* text(`centerZ: ${round(cam.centerZ)}`, 0, 45);
|
|
8102
7745
|
* }
|
|
8103
|
-
* </code>
|
|
8104
|
-
* </div>
|
|
8105
7746
|
*/
|
|
8106
7747
|
|
|
8107
7748
|
/**
|
|
@@ -8115,8 +7756,6 @@ function camera(p5, fn){
|
|
|
8115
7756
|
* @readonly
|
|
8116
7757
|
*
|
|
8117
7758
|
* @example
|
|
8118
|
-
* <div>
|
|
8119
|
-
* <code>
|
|
8120
7759
|
* let cam;
|
|
8121
7760
|
* let font;
|
|
8122
7761
|
*
|
|
@@ -8159,11 +7798,8 @@ function camera(p5, fn){
|
|
|
8159
7798
|
* // Display the value of upX, rounded to the nearest tenth.
|
|
8160
7799
|
* text(`upX: ${round(cam.upX, 1)}`, 0, 45);
|
|
8161
7800
|
* }
|
|
8162
|
-
* </code>
|
|
8163
|
-
* </div>
|
|
8164
7801
|
*
|
|
8165
|
-
*
|
|
8166
|
-
* <code>
|
|
7802
|
+
* @example
|
|
8167
7803
|
* let cam;
|
|
8168
7804
|
* let font;
|
|
8169
7805
|
*
|
|
@@ -8212,8 +7848,6 @@ function camera(p5, fn){
|
|
|
8212
7848
|
* // Display the value of upX, rounded to the nearest tenth.
|
|
8213
7849
|
* text(`upX: ${round(cam.upX, 1)}`, 0, 45);
|
|
8214
7850
|
* }
|
|
8215
|
-
* </code>
|
|
8216
|
-
* </div>
|
|
8217
7851
|
*/
|
|
8218
7852
|
|
|
8219
7853
|
/**
|
|
@@ -8227,8 +7861,6 @@ function camera(p5, fn){
|
|
|
8227
7861
|
* @readonly
|
|
8228
7862
|
*
|
|
8229
7863
|
* @example
|
|
8230
|
-
* <div>
|
|
8231
|
-
* <code>
|
|
8232
7864
|
* let cam;
|
|
8233
7865
|
* let font;
|
|
8234
7866
|
*
|
|
@@ -8271,11 +7903,8 @@ function camera(p5, fn){
|
|
|
8271
7903
|
* // Display the value of upY, rounded to the nearest tenth.
|
|
8272
7904
|
* text(`upY: ${round(cam.upY, 1)}`, 0, 45);
|
|
8273
7905
|
* }
|
|
8274
|
-
* </code>
|
|
8275
|
-
* </div>
|
|
8276
7906
|
*
|
|
8277
|
-
*
|
|
8278
|
-
* <code>
|
|
7907
|
+
* @example
|
|
8279
7908
|
* let cam;
|
|
8280
7909
|
* let font;
|
|
8281
7910
|
*
|
|
@@ -8324,8 +7953,6 @@ function camera(p5, fn){
|
|
|
8324
7953
|
* // Display the value of upY, rounded to the nearest tenth.
|
|
8325
7954
|
* text(`upY: ${round(cam.upY, 1)}`, 0, 45);
|
|
8326
7955
|
* }
|
|
8327
|
-
* </code>
|
|
8328
|
-
* </div>
|
|
8329
7956
|
*/
|
|
8330
7957
|
|
|
8331
7958
|
/**
|
|
@@ -8339,8 +7966,6 @@ function camera(p5, fn){
|
|
|
8339
7966
|
* @readonly
|
|
8340
7967
|
*
|
|
8341
7968
|
* @example
|
|
8342
|
-
* <div>
|
|
8343
|
-
* <code>
|
|
8344
7969
|
* let cam;
|
|
8345
7970
|
* let font;
|
|
8346
7971
|
*
|
|
@@ -8383,11 +8008,8 @@ function camera(p5, fn){
|
|
|
8383
8008
|
* // Display the value of upZ, rounded to the nearest tenth.
|
|
8384
8009
|
* text(`upZ: ${round(cam.upZ, 1)}`, 0, 45);
|
|
8385
8010
|
* }
|
|
8386
|
-
* </code>
|
|
8387
|
-
* </div>
|
|
8388
8011
|
*
|
|
8389
|
-
*
|
|
8390
|
-
* <code>
|
|
8012
|
+
* @example
|
|
8391
8013
|
* let cam;
|
|
8392
8014
|
* let font;
|
|
8393
8015
|
*
|
|
@@ -8436,8 +8058,6 @@ function camera(p5, fn){
|
|
|
8436
8058
|
* // Display the value of upZ, rounded to the nearest tenth.
|
|
8437
8059
|
* text(`upZ: ${round(cam.upZ, 1)}`, 0, 45);
|
|
8438
8060
|
* }
|
|
8439
|
-
* </code>
|
|
8440
|
-
* </div>
|
|
8441
8061
|
*/
|
|
8442
8062
|
}
|
|
8443
8063
|
|
|
@@ -9232,8 +8852,6 @@ class Renderer3D extends Renderer {
|
|
|
9232
8852
|
* @param {Number} [a] opacity
|
|
9233
8853
|
* @chainable
|
|
9234
8854
|
* @example
|
|
9235
|
-
* <div>
|
|
9236
|
-
* <code>
|
|
9237
8855
|
* function setup() {
|
|
9238
8856
|
* createCanvas(200, 200, WEBGL);
|
|
9239
8857
|
* }
|
|
@@ -9246,8 +8864,6 @@ class Renderer3D extends Renderer {
|
|
|
9246
8864
|
* rotateY(frameCount * 0.01);
|
|
9247
8865
|
* box(75, 75, 75);
|
|
9248
8866
|
* }
|
|
9249
|
-
* </code>
|
|
9250
|
-
* </div>
|
|
9251
8867
|
*
|
|
9252
8868
|
* @alt
|
|
9253
8869
|
* black canvas with purple cube spinning
|
|
@@ -9272,8 +8888,6 @@ class Renderer3D extends Renderer {
|
|
|
9272
8888
|
* @param {Number} [v3] blue or brightness value
|
|
9273
8889
|
* @param {Number} [a] opacity
|
|
9274
8890
|
* @example
|
|
9275
|
-
* <div>
|
|
9276
|
-
* <code>
|
|
9277
8891
|
* function setup() {
|
|
9278
8892
|
* createCanvas(200, 200, WEBGL);
|
|
9279
8893
|
* }
|
|
@@ -9286,8 +8900,6 @@ class Renderer3D extends Renderer {
|
|
|
9286
8900
|
* rotateY(frameCount * 0.01);
|
|
9287
8901
|
* box(75, 75, 75);
|
|
9288
8902
|
* }
|
|
9289
|
-
* </code>
|
|
9290
|
-
* </div>
|
|
9291
8903
|
*
|
|
9292
8904
|
* @alt
|
|
9293
8905
|
* black canvas with purple cube with pink outline spinning
|
|
@@ -9881,10 +9493,6 @@ class Renderer3D extends Renderer {
|
|
|
9881
9493
|
this.scratchMat3.inverseTranspose4x4(this.states.uViewMatrix);
|
|
9882
9494
|
shader.setUniform("uCameraNormalMatrix", this.scratchMat3.mat3);
|
|
9883
9495
|
}
|
|
9884
|
-
if (shader.uniforms.uCameraRotation) {
|
|
9885
|
-
this.scratchMat3.inverseTranspose4x4(this.states.uViewMatrix);
|
|
9886
|
-
shader.setUniform("uCameraRotation", this.scratchMat3.mat3);
|
|
9887
|
-
}
|
|
9888
9496
|
shader.setUniform("uViewport", this._viewport);
|
|
9889
9497
|
}
|
|
9890
9498
|
|
|
@@ -10440,88 +10048,80 @@ if (typeof p5 !== "undefined") {
|
|
|
10440
10048
|
|
|
10441
10049
|
|
|
10442
10050
|
function primitives3D(p5, fn){
|
|
10443
|
-
/**
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
|
|
10510
|
-
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
* bezierVertex(50, -40);
|
|
10518
|
-
* bezierVertex(-80, 80);
|
|
10519
|
-
* endShape();
|
|
10520
|
-
* }
|
|
10521
|
-
* </code>
|
|
10522
|
-
* </div>
|
|
10523
|
-
*/
|
|
10524
|
-
|
|
10051
|
+
/**
|
|
10052
|
+
* Sets the stroke rendering mode to balance performance and visual features when drawing lines.
|
|
10053
|
+
*
|
|
10054
|
+
* `strokeMode()` offers two modes:
|
|
10055
|
+
*
|
|
10056
|
+
* - `SIMPLE`: Optimizes for speed by disabling caps, joins, and stroke color features.
|
|
10057
|
+
* Use this mode for faster line rendering when these visual details are unnecessary.
|
|
10058
|
+
* - `FULL`: Enables caps, joins, and stroke color for lines.
|
|
10059
|
+
* This mode provides enhanced visuals but may reduce performance due to additional processing.
|
|
10060
|
+
*
|
|
10061
|
+
* Choose the mode that best suits your application's needs to either improve rendering speed or enhance visual quality.
|
|
10062
|
+
*
|
|
10063
|
+
* @method strokeMode
|
|
10064
|
+
* @param {String} mode - The stroke mode to set. Possible values are:
|
|
10065
|
+
* - `'SIMPLE'`: Fast rendering without caps, joins, or stroke color.
|
|
10066
|
+
* - `'FULL'`: Detailed rendering with caps, joins, and stroke color.
|
|
10067
|
+
*
|
|
10068
|
+
* @example
|
|
10069
|
+
* function setup() {
|
|
10070
|
+
* createCanvas(300, 300, WEBGL);
|
|
10071
|
+
* describe('A sphere with red stroke and a red, wavy line on a gray background. The wavy line have caps, joins and colors.');
|
|
10072
|
+
* }
|
|
10073
|
+
*
|
|
10074
|
+
* function draw() {
|
|
10075
|
+
* background(128);
|
|
10076
|
+
* strokeMode(FULL); // Enables detailed rendering with caps, joins, and stroke color.
|
|
10077
|
+
* push();
|
|
10078
|
+
* strokeWeight(1);
|
|
10079
|
+
* translate(0, -50, 0);
|
|
10080
|
+
* sphere(50);
|
|
10081
|
+
* pop();
|
|
10082
|
+
* orbitControl();
|
|
10083
|
+
*
|
|
10084
|
+
* noFill();
|
|
10085
|
+
* strokeWeight(15);
|
|
10086
|
+
* stroke('red');
|
|
10087
|
+
* beginShape();
|
|
10088
|
+
* bezierOrder(2); // Sets the order of the Bezier curve.
|
|
10089
|
+
* bezierVertex(80, 80);
|
|
10090
|
+
* bezierVertex(50, -40);
|
|
10091
|
+
* bezierVertex(-80, 80);
|
|
10092
|
+
* endShape();
|
|
10093
|
+
* }
|
|
10094
|
+
*
|
|
10095
|
+
* @example
|
|
10096
|
+
* function setup() {
|
|
10097
|
+
* createCanvas(300, 300, WEBGL);
|
|
10098
|
+
* describe('A sphere with red stroke and a wavy line without full curve decorations without caps and color on a gray background.');
|
|
10099
|
+
* }
|
|
10100
|
+
*
|
|
10101
|
+
* function draw() {
|
|
10102
|
+
* background(128);
|
|
10103
|
+
* strokeMode(SIMPLE); // Simplifies stroke rendering for better performance.
|
|
10104
|
+
*
|
|
10105
|
+
* // Draw sphere
|
|
10106
|
+
* push();
|
|
10107
|
+
* strokeWeight(1);
|
|
10108
|
+
* translate(0, -50, 0);
|
|
10109
|
+
* sphere(50);
|
|
10110
|
+
* pop();
|
|
10111
|
+
* orbitControl();
|
|
10112
|
+
*
|
|
10113
|
+
* // Draw modified wavy red line
|
|
10114
|
+
* noFill();
|
|
10115
|
+
* strokeWeight(15);
|
|
10116
|
+
* stroke('red');
|
|
10117
|
+
* beginShape();
|
|
10118
|
+
* bezierOrder(2); // Sets the order of the Bezier curve.
|
|
10119
|
+
* bezierVertex(80, 80);
|
|
10120
|
+
* bezierVertex(50, -40);
|
|
10121
|
+
* bezierVertex(-80, 80);
|
|
10122
|
+
* endShape();
|
|
10123
|
+
* }
|
|
10124
|
+
*/
|
|
10525
10125
|
fn.strokeMode = function (mode) {
|
|
10526
10126
|
if (mode === undefined) {
|
|
10527
10127
|
return this._renderer._simpleLines ? SIMPLE : FULL;
|
|
@@ -10533,6 +10133,7 @@ function primitives3D(p5, fn){
|
|
|
10533
10133
|
throw Error('no such parameter');
|
|
10534
10134
|
}
|
|
10535
10135
|
};
|
|
10136
|
+
|
|
10536
10137
|
/**
|
|
10537
10138
|
* Creates a custom <a href="#/p5.Geometry">p5.Geometry</a> object from
|
|
10538
10139
|
* simpler 3D shapes.
|
|
@@ -10559,8 +10160,6 @@ function primitives3D(p5, fn){
|
|
|
10559
10160
|
* @returns {p5.Geometry} new 3D shape.
|
|
10560
10161
|
*
|
|
10561
10162
|
* @example
|
|
10562
|
-
* <div>
|
|
10563
|
-
* <code>
|
|
10564
10163
|
* // Click and drag the mouse to view the scene from different angles.
|
|
10565
10164
|
*
|
|
10566
10165
|
* let shape;
|
|
@@ -10594,11 +10193,8 @@ function primitives3D(p5, fn){
|
|
|
10594
10193
|
* function createShape() {
|
|
10595
10194
|
* cone();
|
|
10596
10195
|
* }
|
|
10597
|
-
* </code>
|
|
10598
|
-
* </div>
|
|
10599
10196
|
*
|
|
10600
|
-
*
|
|
10601
|
-
* <code>
|
|
10197
|
+
* @example
|
|
10602
10198
|
* // Click and drag the mouse to view the scene from different angles.
|
|
10603
10199
|
*
|
|
10604
10200
|
* let shape;
|
|
@@ -10637,11 +10233,8 @@ function primitives3D(p5, fn){
|
|
|
10637
10233
|
* cylinder(3, 20);
|
|
10638
10234
|
* pop();
|
|
10639
10235
|
* }
|
|
10640
|
-
* </code>
|
|
10641
|
-
* </div>
|
|
10642
10236
|
*
|
|
10643
|
-
*
|
|
10644
|
-
* <code>
|
|
10237
|
+
* @example
|
|
10645
10238
|
* // Click and drag the mouse to view the scene from different angles.
|
|
10646
10239
|
*
|
|
10647
10240
|
* let shape;
|
|
@@ -10687,11 +10280,8 @@ function primitives3D(p5, fn){
|
|
|
10687
10280
|
* cylinder(3, 20);
|
|
10688
10281
|
* pop();
|
|
10689
10282
|
* }
|
|
10690
|
-
* </code>
|
|
10691
|
-
* </div>
|
|
10692
10283
|
*
|
|
10693
|
-
*
|
|
10694
|
-
* <code>
|
|
10284
|
+
* @example
|
|
10695
10285
|
* // Click and drag the mouse to view the scene from different angles.
|
|
10696
10286
|
*
|
|
10697
10287
|
* let button;
|
|
@@ -10754,8 +10344,6 @@ function primitives3D(p5, fn){
|
|
|
10754
10344
|
* pop();
|
|
10755
10345
|
* }
|
|
10756
10346
|
* }
|
|
10757
|
-
* </code>
|
|
10758
|
-
* </div>
|
|
10759
10347
|
*/
|
|
10760
10348
|
fn.buildGeometry = function(callback) {
|
|
10761
10349
|
return this._renderer.buildGeometry(callback);
|
|
@@ -10789,8 +10377,6 @@ function primitives3D(p5, fn){
|
|
|
10789
10377
|
* @param {p5.Geometry} geometry 3D shape whose resources should be freed.
|
|
10790
10378
|
*
|
|
10791
10379
|
* @example
|
|
10792
|
-
* <div>
|
|
10793
|
-
* <code>
|
|
10794
10380
|
* function setup() {
|
|
10795
10381
|
* createCanvas(100, 100, WEBGL);
|
|
10796
10382
|
*
|
|
@@ -10807,11 +10393,8 @@ function primitives3D(p5, fn){
|
|
|
10807
10393
|
* // Free the shape's resources.
|
|
10808
10394
|
* freeGeometry(shape);
|
|
10809
10395
|
* }
|
|
10810
|
-
* </code>
|
|
10811
|
-
* </div>
|
|
10812
10396
|
*
|
|
10813
|
-
*
|
|
10814
|
-
* <code>
|
|
10397
|
+
* @example
|
|
10815
10398
|
* // Click and drag the mouse to view the scene from different angles.
|
|
10816
10399
|
*
|
|
10817
10400
|
* let button;
|
|
@@ -10872,8 +10455,6 @@ function primitives3D(p5, fn){
|
|
|
10872
10455
|
* pop();
|
|
10873
10456
|
* }
|
|
10874
10457
|
* }
|
|
10875
|
-
* </code>
|
|
10876
|
-
* </div>
|
|
10877
10458
|
*/
|
|
10878
10459
|
fn.freeGeometry = function(geometry) {
|
|
10879
10460
|
this._renderer.geometryBufferCache.freeBuffers(geometry.gid);
|
|
@@ -10913,8 +10494,6 @@ function primitives3D(p5, fn){
|
|
|
10913
10494
|
* @chainable
|
|
10914
10495
|
*
|
|
10915
10496
|
* @example
|
|
10916
|
-
* <div>
|
|
10917
|
-
* <code>
|
|
10918
10497
|
* // Click and drag the mouse to view the scene from different angles.
|
|
10919
10498
|
*
|
|
10920
10499
|
* function setup() {
|
|
@@ -10932,11 +10511,8 @@ function primitives3D(p5, fn){
|
|
|
10932
10511
|
* // Draw the plane.
|
|
10933
10512
|
* plane();
|
|
10934
10513
|
* }
|
|
10935
|
-
* </code>
|
|
10936
|
-
* </div>
|
|
10937
10514
|
*
|
|
10938
|
-
*
|
|
10939
|
-
* <code>
|
|
10515
|
+
* @example
|
|
10940
10516
|
* // Click and drag the mouse to view the scene from different angles.
|
|
10941
10517
|
*
|
|
10942
10518
|
* function setup() {
|
|
@@ -10955,11 +10531,8 @@ function primitives3D(p5, fn){
|
|
|
10955
10531
|
* // Set its width and height to 30.
|
|
10956
10532
|
* plane(30);
|
|
10957
10533
|
* }
|
|
10958
|
-
* </code>
|
|
10959
|
-
* </div>
|
|
10960
10534
|
*
|
|
10961
|
-
*
|
|
10962
|
-
* <code>
|
|
10535
|
+
* @example
|
|
10963
10536
|
* // Click and drag the mouse to view the scene from different angles.
|
|
10964
10537
|
*
|
|
10965
10538
|
* function setup() {
|
|
@@ -10978,8 +10551,6 @@ function primitives3D(p5, fn){
|
|
|
10978
10551
|
* // Set its width to 30 and height to 50.
|
|
10979
10552
|
* plane(30, 50);
|
|
10980
10553
|
* }
|
|
10981
|
-
* </code>
|
|
10982
|
-
* </div>
|
|
10983
10554
|
*/
|
|
10984
10555
|
fn.plane = function(
|
|
10985
10556
|
width = 50,
|
|
@@ -11032,8 +10603,6 @@ function primitives3D(p5, fn){
|
|
|
11032
10603
|
* @chainable
|
|
11033
10604
|
*
|
|
11034
10605
|
* @example
|
|
11035
|
-
* <div>
|
|
11036
|
-
* <code>
|
|
11037
10606
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11038
10607
|
*
|
|
11039
10608
|
* function setup() {
|
|
@@ -11051,11 +10620,8 @@ function primitives3D(p5, fn){
|
|
|
11051
10620
|
* // Draw the box.
|
|
11052
10621
|
* box();
|
|
11053
10622
|
* }
|
|
11054
|
-
* </code>
|
|
11055
|
-
* </div>
|
|
11056
10623
|
*
|
|
11057
|
-
*
|
|
11058
|
-
* <code>
|
|
10624
|
+
* @example
|
|
11059
10625
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11060
10626
|
*
|
|
11061
10627
|
* function setup() {
|
|
@@ -11074,11 +10640,8 @@ function primitives3D(p5, fn){
|
|
|
11074
10640
|
* // Set its width and height to 30.
|
|
11075
10641
|
* box(30);
|
|
11076
10642
|
* }
|
|
11077
|
-
* </code>
|
|
11078
|
-
* </div>
|
|
11079
10643
|
*
|
|
11080
|
-
*
|
|
11081
|
-
* <code>
|
|
10644
|
+
* @example
|
|
11082
10645
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11083
10646
|
*
|
|
11084
10647
|
* function setup() {
|
|
@@ -11097,11 +10660,8 @@ function primitives3D(p5, fn){
|
|
|
11097
10660
|
* // Set its width to 30 and height to 50.
|
|
11098
10661
|
* box(30, 50);
|
|
11099
10662
|
* }
|
|
11100
|
-
* </code>
|
|
11101
|
-
* </div>
|
|
11102
10663
|
*
|
|
11103
|
-
*
|
|
11104
|
-
* <code>
|
|
10664
|
+
* @example
|
|
11105
10665
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11106
10666
|
*
|
|
11107
10667
|
* function setup() {
|
|
@@ -11120,8 +10680,6 @@ function primitives3D(p5, fn){
|
|
|
11120
10680
|
* // Set its width to 30, height to 50, and depth to 10.
|
|
11121
10681
|
* box(30, 50, 10);
|
|
11122
10682
|
* }
|
|
11123
|
-
* </code>
|
|
11124
|
-
* </div>
|
|
11125
10683
|
*/
|
|
11126
10684
|
fn.box = function(width, height, depth, detailX, detailY) {
|
|
11127
10685
|
this._assert3d('box');
|
|
@@ -11161,8 +10719,6 @@ function primitives3D(p5, fn){
|
|
|
11161
10719
|
*
|
|
11162
10720
|
* @chainable
|
|
11163
10721
|
* @example
|
|
11164
|
-
* <div>
|
|
11165
|
-
* <code>
|
|
11166
10722
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11167
10723
|
*
|
|
11168
10724
|
* function setup() {
|
|
@@ -11180,11 +10736,8 @@ function primitives3D(p5, fn){
|
|
|
11180
10736
|
* // Draw the sphere.
|
|
11181
10737
|
* sphere();
|
|
11182
10738
|
* }
|
|
11183
|
-
* </code>
|
|
11184
|
-
* </div>
|
|
11185
10739
|
*
|
|
11186
|
-
*
|
|
11187
|
-
* <code>
|
|
10740
|
+
* @example
|
|
11188
10741
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11189
10742
|
*
|
|
11190
10743
|
* function setup() {
|
|
@@ -11203,11 +10756,8 @@ function primitives3D(p5, fn){
|
|
|
11203
10756
|
* // Set its radius to 30.
|
|
11204
10757
|
* sphere(30);
|
|
11205
10758
|
* }
|
|
11206
|
-
* </code>
|
|
11207
|
-
* </div>
|
|
11208
10759
|
*
|
|
11209
|
-
*
|
|
11210
|
-
* <code>
|
|
10760
|
+
* @example
|
|
11211
10761
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11212
10762
|
*
|
|
11213
10763
|
* function setup() {
|
|
@@ -11227,11 +10777,8 @@ function primitives3D(p5, fn){
|
|
|
11227
10777
|
* // Set its detailX to 6.
|
|
11228
10778
|
* sphere(30, 6);
|
|
11229
10779
|
* }
|
|
11230
|
-
* </code>
|
|
11231
|
-
* </div>
|
|
11232
10780
|
*
|
|
11233
|
-
*
|
|
11234
|
-
* <code>
|
|
10781
|
+
* @example
|
|
11235
10782
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11236
10783
|
*
|
|
11237
10784
|
* function setup() {
|
|
@@ -11252,8 +10799,6 @@ function primitives3D(p5, fn){
|
|
|
11252
10799
|
* // Set its detailY to 4.
|
|
11253
10800
|
* sphere(30, 24, 4);
|
|
11254
10801
|
* }
|
|
11255
|
-
* </code>
|
|
11256
|
-
* </div>
|
|
11257
10802
|
*/
|
|
11258
10803
|
fn.sphere = function(radius = 50, detailX = 24, detailY = 16) {
|
|
11259
10804
|
this._assert3d('sphere');
|
|
@@ -11310,8 +10855,6 @@ function primitives3D(p5, fn){
|
|
|
11310
10855
|
* @chainable
|
|
11311
10856
|
*
|
|
11312
10857
|
* @example
|
|
11313
|
-
* <div>
|
|
11314
|
-
* <code>
|
|
11315
10858
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11316
10859
|
*
|
|
11317
10860
|
* function setup() {
|
|
@@ -11329,11 +10872,8 @@ function primitives3D(p5, fn){
|
|
|
11329
10872
|
* // Draw the cylinder.
|
|
11330
10873
|
* cylinder();
|
|
11331
10874
|
* }
|
|
11332
|
-
* </code>
|
|
11333
|
-
* </div>
|
|
11334
10875
|
*
|
|
11335
|
-
*
|
|
11336
|
-
* <code>
|
|
10876
|
+
* @example
|
|
11337
10877
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11338
10878
|
*
|
|
11339
10879
|
* function setup() {
|
|
@@ -11352,11 +10892,8 @@ function primitives3D(p5, fn){
|
|
|
11352
10892
|
* // Set its radius and height to 30.
|
|
11353
10893
|
* cylinder(30);
|
|
11354
10894
|
* }
|
|
11355
|
-
* </code>
|
|
11356
|
-
* </div>
|
|
11357
10895
|
*
|
|
11358
|
-
*
|
|
11359
|
-
* <code>
|
|
10896
|
+
* @example
|
|
11360
10897
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11361
10898
|
*
|
|
11362
10899
|
* function setup() {
|
|
@@ -11375,11 +10912,8 @@ function primitives3D(p5, fn){
|
|
|
11375
10912
|
* // Set its radius to 30 and height to 50.
|
|
11376
10913
|
* cylinder(30, 50);
|
|
11377
10914
|
* }
|
|
11378
|
-
* </code>
|
|
11379
|
-
* </div>
|
|
11380
10915
|
*
|
|
11381
|
-
*
|
|
11382
|
-
* <code>
|
|
10916
|
+
* @example
|
|
11383
10917
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11384
10918
|
*
|
|
11385
10919
|
* function setup() {
|
|
@@ -11399,11 +10933,8 @@ function primitives3D(p5, fn){
|
|
|
11399
10933
|
* // Set its detailX to 5.
|
|
11400
10934
|
* cylinder(30, 50, 5);
|
|
11401
10935
|
* }
|
|
11402
|
-
* </code>
|
|
11403
|
-
* </div>
|
|
11404
10936
|
*
|
|
11405
|
-
*
|
|
11406
|
-
* <code>
|
|
10937
|
+
* @example
|
|
11407
10938
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11408
10939
|
*
|
|
11409
10940
|
* function setup() {
|
|
@@ -11423,11 +10954,8 @@ function primitives3D(p5, fn){
|
|
|
11423
10954
|
* // Set its detailX to 24 and detailY to 2.
|
|
11424
10955
|
* cylinder(30, 50, 24, 2);
|
|
11425
10956
|
* }
|
|
11426
|
-
* </code>
|
|
11427
|
-
* </div>
|
|
11428
10957
|
*
|
|
11429
|
-
*
|
|
11430
|
-
* <code>
|
|
10958
|
+
* @example
|
|
11431
10959
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11432
10960
|
*
|
|
11433
10961
|
* function setup() {
|
|
@@ -11448,11 +10976,8 @@ function primitives3D(p5, fn){
|
|
|
11448
10976
|
* // Don't draw its bottom.
|
|
11449
10977
|
* cylinder(30, 50, 24, 1, false);
|
|
11450
10978
|
* }
|
|
11451
|
-
* </code>
|
|
11452
|
-
* </div>
|
|
11453
10979
|
*
|
|
11454
|
-
*
|
|
11455
|
-
* <code>
|
|
10980
|
+
* @example
|
|
11456
10981
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11457
10982
|
*
|
|
11458
10983
|
* function setup() {
|
|
@@ -11473,8 +10998,6 @@ function primitives3D(p5, fn){
|
|
|
11473
10998
|
* // Don't draw its bottom or top.
|
|
11474
10999
|
* cylinder(30, 50, 24, 1, false, false);
|
|
11475
11000
|
* }
|
|
11476
|
-
* </code>
|
|
11477
|
-
* </div>
|
|
11478
11001
|
*/
|
|
11479
11002
|
fn.cylinder = function(
|
|
11480
11003
|
radius = 50,
|
|
@@ -11537,8 +11060,6 @@ function primitives3D(p5, fn){
|
|
|
11537
11060
|
* @chainable
|
|
11538
11061
|
*
|
|
11539
11062
|
* @example
|
|
11540
|
-
* <div>
|
|
11541
|
-
* <code>
|
|
11542
11063
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11543
11064
|
*
|
|
11544
11065
|
* function setup() {
|
|
@@ -11556,11 +11077,8 @@ function primitives3D(p5, fn){
|
|
|
11556
11077
|
* // Draw the cone.
|
|
11557
11078
|
* cone();
|
|
11558
11079
|
* }
|
|
11559
|
-
* </code>
|
|
11560
|
-
* </div>
|
|
11561
11080
|
*
|
|
11562
|
-
*
|
|
11563
|
-
* <code>
|
|
11081
|
+
* @example
|
|
11564
11082
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11565
11083
|
*
|
|
11566
11084
|
* function setup() {
|
|
@@ -11579,11 +11097,8 @@ function primitives3D(p5, fn){
|
|
|
11579
11097
|
* // Set its radius and height to 30.
|
|
11580
11098
|
* cone(30);
|
|
11581
11099
|
* }
|
|
11582
|
-
* </code>
|
|
11583
|
-
* </div>
|
|
11584
11100
|
*
|
|
11585
|
-
*
|
|
11586
|
-
* <code>
|
|
11101
|
+
* @example
|
|
11587
11102
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11588
11103
|
*
|
|
11589
11104
|
* function setup() {
|
|
@@ -11602,11 +11117,8 @@ function primitives3D(p5, fn){
|
|
|
11602
11117
|
* // Set its radius to 30 and height to 50.
|
|
11603
11118
|
* cone(30, 50);
|
|
11604
11119
|
* }
|
|
11605
|
-
* </code>
|
|
11606
|
-
* </div>
|
|
11607
11120
|
*
|
|
11608
|
-
*
|
|
11609
|
-
* <code>
|
|
11121
|
+
* @example
|
|
11610
11122
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11611
11123
|
*
|
|
11612
11124
|
* function setup() {
|
|
@@ -11626,11 +11138,8 @@ function primitives3D(p5, fn){
|
|
|
11626
11138
|
* // Set its detailX to 5.
|
|
11627
11139
|
* cone(30, 50, 5);
|
|
11628
11140
|
* }
|
|
11629
|
-
* </code>
|
|
11630
|
-
* </div>
|
|
11631
11141
|
*
|
|
11632
|
-
*
|
|
11633
|
-
* <code>
|
|
11142
|
+
* @example
|
|
11634
11143
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11635
11144
|
*
|
|
11636
11145
|
* function setup() {
|
|
@@ -11650,11 +11159,8 @@ function primitives3D(p5, fn){
|
|
|
11650
11159
|
* // Set its detailX to 5.
|
|
11651
11160
|
* cone(30, 50, 5);
|
|
11652
11161
|
* }
|
|
11653
|
-
* </code>
|
|
11654
|
-
* </div>
|
|
11655
11162
|
*
|
|
11656
|
-
*
|
|
11657
|
-
* <code>
|
|
11163
|
+
* @example
|
|
11658
11164
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11659
11165
|
*
|
|
11660
11166
|
* function setup() {
|
|
@@ -11674,11 +11180,8 @@ function primitives3D(p5, fn){
|
|
|
11674
11180
|
* // Set its detailX to 24 and detailY to 2.
|
|
11675
11181
|
* cone(30, 50, 24, 2);
|
|
11676
11182
|
* }
|
|
11677
|
-
* </code>
|
|
11678
|
-
* </div>
|
|
11679
11183
|
*
|
|
11680
|
-
*
|
|
11681
|
-
* <code>
|
|
11184
|
+
* @example
|
|
11682
11185
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11683
11186
|
*
|
|
11684
11187
|
* function setup() {
|
|
@@ -11699,8 +11202,6 @@ function primitives3D(p5, fn){
|
|
|
11699
11202
|
* // Don't draw its base.
|
|
11700
11203
|
* cone(30, 50, 24, 1, false);
|
|
11701
11204
|
* }
|
|
11702
|
-
* </code>
|
|
11703
|
-
* </div>
|
|
11704
11205
|
*/
|
|
11705
11206
|
fn.cone = function(
|
|
11706
11207
|
radius = 50,
|
|
@@ -11760,8 +11261,6 @@ function primitives3D(p5, fn){
|
|
|
11760
11261
|
* @chainable
|
|
11761
11262
|
*
|
|
11762
11263
|
* @example
|
|
11763
|
-
* <div>
|
|
11764
|
-
* <code>
|
|
11765
11264
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11766
11265
|
*
|
|
11767
11266
|
* function setup() {
|
|
@@ -11780,11 +11279,8 @@ function primitives3D(p5, fn){
|
|
|
11780
11279
|
* // Set its radiusX to 30.
|
|
11781
11280
|
* ellipsoid(30);
|
|
11782
11281
|
* }
|
|
11783
|
-
* </code>
|
|
11784
|
-
* </div>
|
|
11785
11282
|
*
|
|
11786
|
-
*
|
|
11787
|
-
* <code>
|
|
11283
|
+
* @example
|
|
11788
11284
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11789
11285
|
*
|
|
11790
11286
|
* function setup() {
|
|
@@ -11804,11 +11300,8 @@ function primitives3D(p5, fn){
|
|
|
11804
11300
|
* // Set its radiusY to 40.
|
|
11805
11301
|
* ellipsoid(30, 40);
|
|
11806
11302
|
* }
|
|
11807
|
-
* </code>
|
|
11808
|
-
* </div>
|
|
11809
11303
|
*
|
|
11810
|
-
*
|
|
11811
|
-
* <code>
|
|
11304
|
+
* @example
|
|
11812
11305
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11813
11306
|
*
|
|
11814
11307
|
* function setup() {
|
|
@@ -11829,11 +11322,8 @@ function primitives3D(p5, fn){
|
|
|
11829
11322
|
* // Set its radiusZ to 50.
|
|
11830
11323
|
* ellipsoid(30, 40, 50);
|
|
11831
11324
|
* }
|
|
11832
|
-
* </code>
|
|
11833
|
-
* </div>
|
|
11834
11325
|
*
|
|
11835
|
-
*
|
|
11836
|
-
* <code>
|
|
11326
|
+
* @example
|
|
11837
11327
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11838
11328
|
*
|
|
11839
11329
|
* function setup() {
|
|
@@ -11855,11 +11345,8 @@ function primitives3D(p5, fn){
|
|
|
11855
11345
|
* // Set its detailX to 4.
|
|
11856
11346
|
* ellipsoid(30, 40, 50, 4);
|
|
11857
11347
|
* }
|
|
11858
|
-
* </code>
|
|
11859
|
-
* </div>
|
|
11860
11348
|
*
|
|
11861
|
-
*
|
|
11862
|
-
* <code>
|
|
11349
|
+
* @example
|
|
11863
11350
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11864
11351
|
*
|
|
11865
11352
|
* function setup() {
|
|
@@ -11882,8 +11369,6 @@ function primitives3D(p5, fn){
|
|
|
11882
11369
|
* // Set its detailY to 3.
|
|
11883
11370
|
* ellipsoid(30, 40, 50, 4, 3);
|
|
11884
11371
|
* }
|
|
11885
|
-
* </code>
|
|
11886
|
-
* </div>
|
|
11887
11372
|
*/
|
|
11888
11373
|
fn.ellipsoid = function(
|
|
11889
11374
|
radiusX = 50,
|
|
@@ -11933,8 +11418,6 @@ function primitives3D(p5, fn){
|
|
|
11933
11418
|
* @chainable
|
|
11934
11419
|
*
|
|
11935
11420
|
* @example
|
|
11936
|
-
* <div>
|
|
11937
|
-
* <code>
|
|
11938
11421
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11939
11422
|
*
|
|
11940
11423
|
* function setup() {
|
|
@@ -11952,11 +11435,8 @@ function primitives3D(p5, fn){
|
|
|
11952
11435
|
* // Draw the torus.
|
|
11953
11436
|
* torus();
|
|
11954
11437
|
* }
|
|
11955
|
-
* </code>
|
|
11956
|
-
* </div>
|
|
11957
11438
|
*
|
|
11958
|
-
*
|
|
11959
|
-
* <code>
|
|
11439
|
+
* @example
|
|
11960
11440
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11961
11441
|
*
|
|
11962
11442
|
* function setup() {
|
|
@@ -11975,11 +11455,8 @@ function primitives3D(p5, fn){
|
|
|
11975
11455
|
* // Set its radius to 30.
|
|
11976
11456
|
* torus(30);
|
|
11977
11457
|
* }
|
|
11978
|
-
* </code>
|
|
11979
|
-
* </div>
|
|
11980
11458
|
*
|
|
11981
|
-
*
|
|
11982
|
-
* <code>
|
|
11459
|
+
* @example
|
|
11983
11460
|
* // Click and drag the mouse to view the scene from different angles.
|
|
11984
11461
|
*
|
|
11985
11462
|
* function setup() {
|
|
@@ -11998,11 +11475,8 @@ function primitives3D(p5, fn){
|
|
|
11998
11475
|
* // Set its radius to 30 and tubeRadius to 15.
|
|
11999
11476
|
* torus(30, 15);
|
|
12000
11477
|
* }
|
|
12001
|
-
* </code>
|
|
12002
|
-
* </div>
|
|
12003
11478
|
*
|
|
12004
|
-
*
|
|
12005
|
-
* <code>
|
|
11479
|
+
* @example
|
|
12006
11480
|
* // Click and drag the mouse to view the scene from different angles.
|
|
12007
11481
|
*
|
|
12008
11482
|
* function setup() {
|
|
@@ -12022,11 +11496,8 @@ function primitives3D(p5, fn){
|
|
|
12022
11496
|
* // Set its detailX to 5.
|
|
12023
11497
|
* torus(30, 15, 5);
|
|
12024
11498
|
* }
|
|
12025
|
-
* </code>
|
|
12026
|
-
* </div>
|
|
12027
11499
|
*
|
|
12028
|
-
*
|
|
12029
|
-
* <code>
|
|
11500
|
+
* @example
|
|
12030
11501
|
* // Click and drag the mouse to view the scene from different angles.
|
|
12031
11502
|
*
|
|
12032
11503
|
* function setup() {
|
|
@@ -12047,8 +11518,6 @@ function primitives3D(p5, fn){
|
|
|
12047
11518
|
* // Set its detailY to 3.
|
|
12048
11519
|
* torus(30, 15, 5, 3);
|
|
12049
11520
|
* }
|
|
12050
|
-
* </code>
|
|
12051
|
-
* </div>
|
|
12052
11521
|
*/
|
|
12053
11522
|
fn.torus = function(radius, tubeRadius, detailX, detailY) {
|
|
12054
11523
|
this._assert3d('torus');
|
|
@@ -12077,8 +11546,6 @@ function primitives3D(p5, fn){
|
|
|
12077
11546
|
* @param {Number} z z-coordinate of point
|
|
12078
11547
|
* @chainable
|
|
12079
11548
|
* @example
|
|
12080
|
-
* <div>
|
|
12081
|
-
* <code>
|
|
12082
11549
|
* function setup() {
|
|
12083
11550
|
* createCanvas(100, 100, WEBGL);
|
|
12084
11551
|
* }
|
|
@@ -12095,8 +11562,6 @@ function primitives3D(p5, fn){
|
|
|
12095
11562
|
* strokeWeight(1);
|
|
12096
11563
|
* point(0, -25);
|
|
12097
11564
|
* }
|
|
12098
|
-
* </code>
|
|
12099
|
-
* </div>
|
|
12100
11565
|
*/
|
|
12101
11566
|
Renderer3D.prototype.point = function(x, y, z = 0) {
|
|
12102
11567
|
this.beginShape(POINTS);
|
|
@@ -12577,8 +12042,6 @@ function primitives3D(p5, fn){
|
|
|
12577
12042
|
* @param {Number} z1 z-coordinate of second vertex
|
|
12578
12043
|
* @chainable
|
|
12579
12044
|
* @example
|
|
12580
|
-
* <div>
|
|
12581
|
-
* <code>
|
|
12582
12045
|
* //draw a line
|
|
12583
12046
|
* function setup() {
|
|
12584
12047
|
* createCanvas(100, 100, WEBGL);
|
|
@@ -12592,8 +12055,6 @@ function primitives3D(p5, fn){
|
|
|
12592
12055
|
* fill(255, 0, 0);
|
|
12593
12056
|
* line(10, 10, 0, 60, 60, 20);
|
|
12594
12057
|
* }
|
|
12595
|
-
* </code>
|
|
12596
|
-
* </div>
|
|
12597
12058
|
*/
|
|
12598
12059
|
Renderer3D.prototype.line = function(...args) {
|
|
12599
12060
|
if (args.length === 6) {
|
|
@@ -13147,9 +12608,6 @@ function primitives3D(p5, fn){
|
|
|
13147
12608
|
* @chainable
|
|
13148
12609
|
*
|
|
13149
12610
|
* @example
|
|
13150
|
-
*
|
|
13151
|
-
* <div>
|
|
13152
|
-
* <code>
|
|
13153
12611
|
* function setup() {
|
|
13154
12612
|
* createCanvas(100, 100, WEBGL);
|
|
13155
12613
|
*
|
|
@@ -13187,8 +12645,6 @@ function primitives3D(p5, fn){
|
|
|
13187
12645
|
* 'A gray square with a jagged curve drawn in three segments. The curve is a sideways U shape with red segments on top and bottom, and a black segment on the right. The endpoints of all the segments are marked with dots.'
|
|
13188
12646
|
* );
|
|
13189
12647
|
* }
|
|
13190
|
-
* </code>
|
|
13191
|
-
* </div>
|
|
13192
12648
|
*/
|
|
13193
12649
|
fn.curveDetail = function(d) {
|
|
13194
12650
|
if (!(this._renderer instanceof Renderer3D)) {
|
|
@@ -13251,8 +12707,6 @@ function light(p5, fn){
|
|
|
13251
12707
|
* @chainable
|
|
13252
12708
|
*
|
|
13253
12709
|
* @example
|
|
13254
|
-
* <div>
|
|
13255
|
-
* <code>
|
|
13256
12710
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13257
12711
|
* // Double-click the canvas to turn on the light.
|
|
13258
12712
|
*
|
|
@@ -13284,11 +12738,8 @@ function light(p5, fn){
|
|
|
13284
12738
|
* function doubleClicked() {
|
|
13285
12739
|
* isLit = true;
|
|
13286
12740
|
* }
|
|
13287
|
-
* </code>
|
|
13288
|
-
* </div>
|
|
13289
12741
|
*
|
|
13290
|
-
*
|
|
13291
|
-
* <code>
|
|
12742
|
+
* @example
|
|
13292
12743
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13293
12744
|
*
|
|
13294
12745
|
* function setup() {
|
|
@@ -13311,11 +12762,8 @@ function light(p5, fn){
|
|
|
13311
12762
|
* // Draw the sphere.
|
|
13312
12763
|
* sphere();
|
|
13313
12764
|
* }
|
|
13314
|
-
* </code>
|
|
13315
|
-
* </div>
|
|
13316
12765
|
*
|
|
13317
|
-
*
|
|
13318
|
-
* <code>
|
|
12766
|
+
* @example
|
|
13319
12767
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13320
12768
|
*
|
|
13321
12769
|
* function setup() {
|
|
@@ -13337,11 +12785,8 @@ function light(p5, fn){
|
|
|
13337
12785
|
* // Draw the sphere.
|
|
13338
12786
|
* sphere(30);
|
|
13339
12787
|
* }
|
|
13340
|
-
* </code>
|
|
13341
|
-
* </div>
|
|
13342
12788
|
*
|
|
13343
|
-
*
|
|
13344
|
-
* <code>
|
|
12789
|
+
* @example
|
|
13345
12790
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13346
12791
|
*
|
|
13347
12792
|
* function setup() {
|
|
@@ -13363,30 +12808,24 @@ function light(p5, fn){
|
|
|
13363
12808
|
* // Draw the sphere.
|
|
13364
12809
|
* sphere(30);
|
|
13365
12810
|
* }
|
|
13366
|
-
* </code>
|
|
13367
|
-
* </div>
|
|
13368
12811
|
*/
|
|
13369
|
-
|
|
13370
12812
|
/**
|
|
13371
12813
|
* @method ambientLight
|
|
13372
12814
|
* @param {Number} gray grayscale value between 0 and 255.
|
|
13373
12815
|
* @param {Number} [alpha]
|
|
13374
12816
|
* @chainable
|
|
13375
12817
|
*/
|
|
13376
|
-
|
|
13377
12818
|
/**
|
|
13378
12819
|
* @method ambientLight
|
|
13379
12820
|
* @param {String} value color as a CSS string.
|
|
13380
12821
|
* @chainable
|
|
13381
12822
|
*/
|
|
13382
|
-
|
|
13383
12823
|
/**
|
|
13384
12824
|
* @method ambientLight
|
|
13385
12825
|
* @param {Number[]} values color as an array of RGBA, HSBA, or HSLA
|
|
13386
12826
|
* values.
|
|
13387
12827
|
* @chainable
|
|
13388
12828
|
*/
|
|
13389
|
-
|
|
13390
12829
|
/**
|
|
13391
12830
|
* @method ambientLight
|
|
13392
12831
|
* @param {p5.Color} color color as a <a href="#/p5.Color">p5.Color</a> object.
|
|
@@ -13448,8 +12887,6 @@ function light(p5, fn){
|
|
|
13448
12887
|
* @chainable
|
|
13449
12888
|
*
|
|
13450
12889
|
* @example
|
|
13451
|
-
* <div>
|
|
13452
|
-
* <code>
|
|
13453
12890
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13454
12891
|
*
|
|
13455
12892
|
* function setup() {
|
|
@@ -13468,11 +12905,8 @@ function light(p5, fn){
|
|
|
13468
12905
|
* // Draw the sphere.
|
|
13469
12906
|
* sphere(30);
|
|
13470
12907
|
* }
|
|
13471
|
-
* </code>
|
|
13472
|
-
* </div>
|
|
13473
12908
|
*
|
|
13474
|
-
*
|
|
13475
|
-
* <code>
|
|
12909
|
+
* @example
|
|
13476
12910
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13477
12911
|
* // Double-click the canvas to add a point light.
|
|
13478
12912
|
*
|
|
@@ -13509,11 +12943,8 @@ function light(p5, fn){
|
|
|
13509
12943
|
* function doubleClicked() {
|
|
13510
12944
|
* isLit = true;
|
|
13511
12945
|
* }
|
|
13512
|
-
* </code>
|
|
13513
|
-
* </div>
|
|
13514
12946
|
*
|
|
13515
|
-
*
|
|
13516
|
-
* <code>
|
|
12947
|
+
* @example
|
|
13517
12948
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13518
12949
|
*
|
|
13519
12950
|
* function setup() {
|
|
@@ -13545,11 +12976,8 @@ function light(p5, fn){
|
|
|
13545
12976
|
* // Draw the sphere.
|
|
13546
12977
|
* sphere(30);
|
|
13547
12978
|
* }
|
|
13548
|
-
* </code>
|
|
13549
|
-
* </div>
|
|
13550
12979
|
*
|
|
13551
|
-
*
|
|
13552
|
-
* <code>
|
|
12980
|
+
* @example
|
|
13553
12981
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13554
12982
|
*
|
|
13555
12983
|
* function setup() {
|
|
@@ -13580,11 +13008,8 @@ function light(p5, fn){
|
|
|
13580
13008
|
* // Draw the sphere.
|
|
13581
13009
|
* sphere(30);
|
|
13582
13010
|
* }
|
|
13583
|
-
* </code>
|
|
13584
|
-
* </div>
|
|
13585
13011
|
*
|
|
13586
|
-
*
|
|
13587
|
-
* <code>
|
|
13012
|
+
* @example
|
|
13588
13013
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13589
13014
|
*
|
|
13590
13015
|
* function setup() {
|
|
@@ -13615,29 +13040,23 @@ function light(p5, fn){
|
|
|
13615
13040
|
* // Draw the sphere.
|
|
13616
13041
|
* sphere(30);
|
|
13617
13042
|
* }
|
|
13618
|
-
* </code>
|
|
13619
|
-
* </div>
|
|
13620
13043
|
*/
|
|
13621
|
-
|
|
13622
13044
|
/**
|
|
13623
13045
|
* @method specularColor
|
|
13624
13046
|
* @param {Number} gray grayscale value between 0 and 255.
|
|
13625
13047
|
* @chainable
|
|
13626
13048
|
*/
|
|
13627
|
-
|
|
13628
13049
|
/**
|
|
13629
13050
|
* @method specularColor
|
|
13630
13051
|
* @param {String} value color as a CSS string.
|
|
13631
13052
|
* @chainable
|
|
13632
13053
|
*/
|
|
13633
|
-
|
|
13634
13054
|
/**
|
|
13635
13055
|
* @method specularColor
|
|
13636
13056
|
* @param {Number[]} values color as an array of RGBA, HSBA, or HSLA
|
|
13637
13057
|
* values.
|
|
13638
13058
|
* @chainable
|
|
13639
13059
|
*/
|
|
13640
|
-
|
|
13641
13060
|
/**
|
|
13642
13061
|
* @method specularColor
|
|
13643
13062
|
* @param {p5.Color} color color as a <a href="#/p5.Color">p5.Color</a> object.
|
|
@@ -13708,8 +13127,6 @@ function light(p5, fn){
|
|
|
13708
13127
|
* @chainable
|
|
13709
13128
|
*
|
|
13710
13129
|
* @example
|
|
13711
|
-
* <div>
|
|
13712
|
-
* <code>
|
|
13713
13130
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13714
13131
|
* // Double-click to turn on the directional light.
|
|
13715
13132
|
*
|
|
@@ -13740,11 +13157,8 @@ function light(p5, fn){
|
|
|
13740
13157
|
* // Draw the sphere.
|
|
13741
13158
|
* sphere(30);
|
|
13742
13159
|
* }
|
|
13743
|
-
* </code>
|
|
13744
|
-
* </div>
|
|
13745
13160
|
*
|
|
13746
|
-
*
|
|
13747
|
-
* <code>
|
|
13161
|
+
* @example
|
|
13748
13162
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13749
13163
|
*
|
|
13750
13164
|
* function setup() {
|
|
@@ -13770,11 +13184,8 @@ function light(p5, fn){
|
|
|
13770
13184
|
* // Draw the sphere.
|
|
13771
13185
|
* sphere(30);
|
|
13772
13186
|
* }
|
|
13773
|
-
* </code>
|
|
13774
|
-
* </div>
|
|
13775
13187
|
*
|
|
13776
|
-
*
|
|
13777
|
-
* <code>
|
|
13188
|
+
* @example
|
|
13778
13189
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13779
13190
|
*
|
|
13780
13191
|
* function setup() {
|
|
@@ -13801,10 +13212,7 @@ function light(p5, fn){
|
|
|
13801
13212
|
* // Draw the sphere.
|
|
13802
13213
|
* sphere(30);
|
|
13803
13214
|
* }
|
|
13804
|
-
* </code>
|
|
13805
|
-
* </div>
|
|
13806
13215
|
*/
|
|
13807
|
-
|
|
13808
13216
|
/**
|
|
13809
13217
|
* @method directionalLight
|
|
13810
13218
|
* @param {Number} v1
|
|
@@ -13814,7 +13222,6 @@ function light(p5, fn){
|
|
|
13814
13222
|
* <a href="#/p5.Vector">p5.Vector</a> object.
|
|
13815
13223
|
* @chainable
|
|
13816
13224
|
*/
|
|
13817
|
-
|
|
13818
13225
|
/**
|
|
13819
13226
|
* @method directionalLight
|
|
13820
13227
|
* @param {p5.Color|Number[]|String} color color as a <a href="#/p5.Color">p5.Color</a> object,
|
|
@@ -13824,7 +13231,6 @@ function light(p5, fn){
|
|
|
13824
13231
|
* @param {Number} z
|
|
13825
13232
|
* @chainable
|
|
13826
13233
|
*/
|
|
13827
|
-
|
|
13828
13234
|
/**
|
|
13829
13235
|
* @method directionalLight
|
|
13830
13236
|
* @param {p5.Color|Number[]|String} color
|
|
@@ -13893,9 +13299,6 @@ function light(p5, fn){
|
|
|
13893
13299
|
* @chainable
|
|
13894
13300
|
*
|
|
13895
13301
|
* @example
|
|
13896
|
-
*
|
|
13897
|
-
* <div>
|
|
13898
|
-
* <code>
|
|
13899
13302
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13900
13303
|
* // Double-click to turn on the point light.
|
|
13901
13304
|
*
|
|
@@ -13931,11 +13334,8 @@ function light(p5, fn){
|
|
|
13931
13334
|
* function doubleClicked() {
|
|
13932
13335
|
* isLit = true;
|
|
13933
13336
|
* }
|
|
13934
|
-
* </code>
|
|
13935
|
-
* </div>
|
|
13936
13337
|
*
|
|
13937
|
-
*
|
|
13938
|
-
* <code>
|
|
13338
|
+
* @example
|
|
13939
13339
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13940
13340
|
*
|
|
13941
13341
|
* function setup() {
|
|
@@ -13961,11 +13361,8 @@ function light(p5, fn){
|
|
|
13961
13361
|
* // Draw the sphere.
|
|
13962
13362
|
* sphere(30);
|
|
13963
13363
|
* }
|
|
13964
|
-
* </code>
|
|
13965
|
-
* </div>
|
|
13966
13364
|
*
|
|
13967
|
-
*
|
|
13968
|
-
* <code>
|
|
13365
|
+
* @example
|
|
13969
13366
|
* // Click and drag the mouse to view the scene from different angles.
|
|
13970
13367
|
*
|
|
13971
13368
|
* function setup() {
|
|
@@ -13992,11 +13389,8 @@ function light(p5, fn){
|
|
|
13992
13389
|
* // Draw the sphere.
|
|
13993
13390
|
* sphere(30);
|
|
13994
13391
|
* }
|
|
13995
|
-
* </code>
|
|
13996
|
-
* </div>
|
|
13997
13392
|
*
|
|
13998
|
-
*
|
|
13999
|
-
* <code>
|
|
13393
|
+
* @example
|
|
14000
13394
|
* // Click and drag the mouse to view the scene from different angles.
|
|
14001
13395
|
*
|
|
14002
13396
|
* function setup() {
|
|
@@ -14044,10 +13438,7 @@ function light(p5, fn){
|
|
|
14044
13438
|
* sphere(10);
|
|
14045
13439
|
* pop();
|
|
14046
13440
|
* }
|
|
14047
|
-
* </code>
|
|
14048
|
-
* </div>
|
|
14049
13441
|
*/
|
|
14050
|
-
|
|
14051
13442
|
/**
|
|
14052
13443
|
* @method pointLight
|
|
14053
13444
|
* @param {Number} v1
|
|
@@ -14057,7 +13448,6 @@ function light(p5, fn){
|
|
|
14057
13448
|
* <a href="#/p5.Vector">p5.Vector</a> object.
|
|
14058
13449
|
* @chainable
|
|
14059
13450
|
*/
|
|
14060
|
-
|
|
14061
13451
|
/**
|
|
14062
13452
|
* @method pointLight
|
|
14063
13453
|
* @param {p5.Color|Number[]|String} color color as a <a href="#/p5.Color">p5.Color</a> object,
|
|
@@ -14067,7 +13457,6 @@ function light(p5, fn){
|
|
|
14067
13457
|
* @param {Number} z
|
|
14068
13458
|
* @chainable
|
|
14069
13459
|
*/
|
|
14070
|
-
|
|
14071
13460
|
/**
|
|
14072
13461
|
* @method pointLight
|
|
14073
13462
|
* @param {p5.Color|Number[]|String} color
|
|
@@ -14101,8 +13490,6 @@ function light(p5, fn){
|
|
|
14101
13490
|
* @param {p5.Image} img image to use as the light source.
|
|
14102
13491
|
*
|
|
14103
13492
|
* @example
|
|
14104
|
-
* <div class="notest">
|
|
14105
|
-
* <code>
|
|
14106
13493
|
* // Click and drag the mouse to view the scene from different angles.
|
|
14107
13494
|
*
|
|
14108
13495
|
* let img;
|
|
@@ -14137,8 +13524,6 @@ function light(p5, fn){
|
|
|
14137
13524
|
* // Draw the sphere.
|
|
14138
13525
|
* sphere(30);
|
|
14139
13526
|
* }
|
|
14140
|
-
* </code>
|
|
14141
|
-
* </div>
|
|
14142
13527
|
*/
|
|
14143
13528
|
fn.imageLight = function (img) {
|
|
14144
13529
|
this._renderer.imageLight(img);
|
|
@@ -14157,8 +13542,6 @@ function light(p5, fn){
|
|
|
14157
13542
|
* @param {p5.Image} img 360˚ image to use as the background.
|
|
14158
13543
|
*
|
|
14159
13544
|
* @example
|
|
14160
|
-
* <div class="notest">
|
|
14161
|
-
* <code>
|
|
14162
13545
|
* // Click and drag the mouse to view the scene from different angles.
|
|
14163
13546
|
*
|
|
14164
13547
|
* let img;
|
|
@@ -14191,8 +13574,6 @@ function light(p5, fn){
|
|
|
14191
13574
|
* // Draw the sphere.
|
|
14192
13575
|
* sphere(30);
|
|
14193
13576
|
* }
|
|
14194
|
-
* </code>
|
|
14195
|
-
* </div>
|
|
14196
13577
|
*/
|
|
14197
13578
|
fn.panorama = function (img) {
|
|
14198
13579
|
this.filter(this._renderer._getSphereMapping(img));
|
|
@@ -14212,8 +13593,6 @@ function light(p5, fn){
|
|
|
14212
13593
|
* @chainable
|
|
14213
13594
|
*
|
|
14214
13595
|
* @example
|
|
14215
|
-
* <div>
|
|
14216
|
-
* <code>
|
|
14217
13596
|
* // Click and drag the mouse to view the scene from different angles.
|
|
14218
13597
|
* // Double-click to turn on the lights.
|
|
14219
13598
|
*
|
|
@@ -14244,11 +13623,8 @@ function light(p5, fn){
|
|
|
14244
13623
|
* function doubleClicked() {
|
|
14245
13624
|
* isLit = true;
|
|
14246
13625
|
* }
|
|
14247
|
-
* </code>
|
|
14248
|
-
* </div>
|
|
14249
13626
|
*
|
|
14250
|
-
*
|
|
14251
|
-
* <code>
|
|
13627
|
+
* @example
|
|
14252
13628
|
* // Click and drag the mouse to view the scene from different angles.
|
|
14253
13629
|
*
|
|
14254
13630
|
* function setup() {
|
|
@@ -14270,8 +13646,6 @@ function light(p5, fn){
|
|
|
14270
13646
|
* // Draw the box.
|
|
14271
13647
|
* box();
|
|
14272
13648
|
* }
|
|
14273
|
-
* </code>
|
|
14274
|
-
* </div>
|
|
14275
13649
|
*/
|
|
14276
13650
|
fn.lights = function () {
|
|
14277
13651
|
this._assert3d('lights');
|
|
@@ -14304,8 +13678,6 @@ function light(p5, fn){
|
|
|
14304
13678
|
* @chainable
|
|
14305
13679
|
*
|
|
14306
13680
|
* @example
|
|
14307
|
-
* <div>
|
|
14308
|
-
* <code>
|
|
14309
13681
|
* // Click and drag the mouse to view the scene from different angles.
|
|
14310
13682
|
* // Double-click to change the falloff rate.
|
|
14311
13683
|
*
|
|
@@ -14342,8 +13714,6 @@ function light(p5, fn){
|
|
|
14342
13714
|
* function doubleClicked() {
|
|
14343
13715
|
* useFalloff = true;
|
|
14344
13716
|
* }
|
|
14345
|
-
* </code>
|
|
14346
|
-
* </div>
|
|
14347
13717
|
*/
|
|
14348
13718
|
fn.lightFalloff = function (
|
|
14349
13719
|
constantAttenuation,
|
|
@@ -14405,8 +13775,6 @@ function light(p5, fn){
|
|
|
14405
13775
|
* @chainable
|
|
14406
13776
|
*
|
|
14407
13777
|
* @example
|
|
14408
|
-
* <div>
|
|
14409
|
-
* <code>
|
|
14410
13778
|
* // Click and drag the mouse to view the scene from different angles.
|
|
14411
13779
|
* // Double-click to adjust the spotlight.
|
|
14412
13780
|
*
|
|
@@ -14442,11 +13810,8 @@ function light(p5, fn){
|
|
|
14442
13810
|
* function doubleClicked() {
|
|
14443
13811
|
* isLit = true;
|
|
14444
13812
|
* }
|
|
14445
|
-
* </code>
|
|
14446
|
-
* </div>
|
|
14447
13813
|
*
|
|
14448
|
-
*
|
|
14449
|
-
* <code>
|
|
13814
|
+
* @example
|
|
14450
13815
|
* // Click and drag the mouse to view the scene from different angles.
|
|
14451
13816
|
* // Double-click to adjust the spotlight.
|
|
14452
13817
|
*
|
|
@@ -14486,8 +13851,6 @@ function light(p5, fn){
|
|
|
14486
13851
|
* function doubleClicked() {
|
|
14487
13852
|
* isLit = true;
|
|
14488
13853
|
* }
|
|
14489
|
-
* </code>
|
|
14490
|
-
* </div>
|
|
14491
13854
|
*/
|
|
14492
13855
|
/**
|
|
14493
13856
|
* @method spotLight
|
|
@@ -14600,8 +13963,6 @@ function light(p5, fn){
|
|
|
14600
13963
|
* @chainable
|
|
14601
13964
|
*
|
|
14602
13965
|
* @example
|
|
14603
|
-
* <div>
|
|
14604
|
-
* <code>
|
|
14605
13966
|
* // Click and drag the mouse to view the scene from different angles.
|
|
14606
13967
|
*
|
|
14607
13968
|
* function setup() {
|
|
@@ -14640,8 +14001,6 @@ function light(p5, fn){
|
|
|
14640
14001
|
* sphere(20);
|
|
14641
14002
|
* pop();
|
|
14642
14003
|
* }
|
|
14643
|
-
* </code>
|
|
14644
|
-
* </div>
|
|
14645
14004
|
*/
|
|
14646
14005
|
fn.noLights = function (...args) {
|
|
14647
14006
|
this._assert3d('noLights');
|
|
@@ -15135,8 +14494,6 @@ function material(p5, fn) {
|
|
|
15135
14494
|
* @return {Promise<p5.Shader>} new shader created from the vertex and fragment shader files.
|
|
15136
14495
|
*
|
|
15137
14496
|
* @example
|
|
15138
|
-
* <div modernizr='webgl'>
|
|
15139
|
-
* <code>
|
|
15140
14497
|
* // Note: A "uniform" is a global variable within a shader program.
|
|
15141
14498
|
*
|
|
15142
14499
|
* let mandelbrot;
|
|
@@ -15161,11 +14518,8 @@ function material(p5, fn) {
|
|
|
15161
14518
|
*
|
|
15162
14519
|
* describe('A black fractal image on a magenta background.');
|
|
15163
14520
|
* }
|
|
15164
|
-
* </code>
|
|
15165
|
-
* </div>
|
|
15166
14521
|
*
|
|
15167
|
-
*
|
|
15168
|
-
* <code>
|
|
14522
|
+
* @example
|
|
15169
14523
|
* // Note: A "uniform" is a global variable within a shader program.
|
|
15170
14524
|
*
|
|
15171
14525
|
* let mandelbrot;
|
|
@@ -15192,8 +14546,6 @@ function material(p5, fn) {
|
|
|
15192
14546
|
* // Add a quad as a display surface for the shader.
|
|
15193
14547
|
* quad(-1, -1, 1, -1, 1, 1, -1, 1);
|
|
15194
14548
|
* }
|
|
15195
|
-
* </code>
|
|
15196
|
-
* </div>
|
|
15197
14549
|
*/
|
|
15198
14550
|
fn.loadShader = async function (
|
|
15199
14551
|
vertFilename,
|
|
@@ -15623,6 +14975,7 @@ function material(p5, fn) {
|
|
|
15623
14975
|
* In your function, you can use <a href="#/p5/filterColor">`filterColor`</a> with a function
|
|
15624
14976
|
* that will be called for each pixel on the image to determine its final color. You can
|
|
15625
14977
|
* read the color of the current pixel with `getTexture(canvasContent, coord)`.
|
|
14978
|
+
* See <a href="#/p5/getTexture">getTexture()</a>.
|
|
15626
14979
|
*
|
|
15627
14980
|
* ```js example
|
|
15628
14981
|
* async function setup() {
|
|
@@ -15813,8 +15166,6 @@ function material(p5, fn) {
|
|
|
15813
15166
|
* @returns {p5.Shader} new shader object created from the fragment shader.
|
|
15814
15167
|
*
|
|
15815
15168
|
* @example
|
|
15816
|
-
* <div modernizr='webgl'>
|
|
15817
|
-
* <code>
|
|
15818
15169
|
* function setup() {
|
|
15819
15170
|
* let fragSrc = `precision highp float;
|
|
15820
15171
|
* void main() {
|
|
@@ -15826,11 +15177,8 @@ function material(p5, fn) {
|
|
|
15826
15177
|
* filter(s);
|
|
15827
15178
|
* describe('a yellow canvas');
|
|
15828
15179
|
* }
|
|
15829
|
-
* </code>
|
|
15830
|
-
* </div>
|
|
15831
15180
|
*
|
|
15832
|
-
*
|
|
15833
|
-
* <code>
|
|
15181
|
+
* @example
|
|
15834
15182
|
* let img, s;
|
|
15835
15183
|
* async function setup() {
|
|
15836
15184
|
* img = await loadImage('assets/bricks.jpg');
|
|
@@ -15866,8 +15214,6 @@ function material(p5, fn) {
|
|
|
15866
15214
|
* filter(s);
|
|
15867
15215
|
* describe('a image of bricks tinted dark blue');
|
|
15868
15216
|
* }
|
|
15869
|
-
* </code>
|
|
15870
|
-
* </div>
|
|
15871
15217
|
*/
|
|
15872
15218
|
fn.createFilterShader = function (fragSrc, skipContextCheck = false) {
|
|
15873
15219
|
// p5._validateParameters('buildFilterShader', arguments);
|
|
@@ -16104,7 +15450,7 @@ function material(p5, fn) {
|
|
|
16104
15450
|
*
|
|
16105
15451
|
*/
|
|
16106
15452
|
fn.shader = function (s) {
|
|
16107
|
-
this._assert3d(
|
|
15453
|
+
this._assert3d('shader');
|
|
16108
15454
|
// p5._validateParameters('shader', arguments);
|
|
16109
15455
|
|
|
16110
15456
|
this._renderer.shader(s);
|
|
@@ -16134,8 +15480,6 @@ function material(p5, fn) {
|
|
|
16134
15480
|
*
|
|
16135
15481
|
*
|
|
16136
15482
|
* @example
|
|
16137
|
-
* <div modernizr='webgl'>
|
|
16138
|
-
* <code>
|
|
16139
15483
|
* let animatedStrokeShader;
|
|
16140
15484
|
*
|
|
16141
15485
|
* let vertSrc = `
|
|
@@ -16228,13 +15572,8 @@ function material(p5, fn) {
|
|
|
16228
15572
|
* orbitControl();
|
|
16229
15573
|
* box(50);
|
|
16230
15574
|
* }
|
|
16231
|
-
* </code>
|
|
16232
|
-
* </div>
|
|
16233
|
-
*
|
|
16234
15575
|
*
|
|
16235
15576
|
* @example
|
|
16236
|
-
* <div modernizr='webgl'>
|
|
16237
|
-
* <code>
|
|
16238
15577
|
* let myShader;
|
|
16239
15578
|
*
|
|
16240
15579
|
* function setup() {
|
|
@@ -16273,8 +15612,6 @@ function material(p5, fn) {
|
|
|
16273
15612
|
* }
|
|
16274
15613
|
* endShape();
|
|
16275
15614
|
* }
|
|
16276
|
-
* </code>
|
|
16277
|
-
* </div>
|
|
16278
15615
|
*/
|
|
16279
15616
|
fn.strokeShader = function (s) {
|
|
16280
15617
|
this._assert3d("strokeShader");
|
|
@@ -16304,8 +15641,6 @@ function material(p5, fn) {
|
|
|
16304
15641
|
* to apply for images.
|
|
16305
15642
|
*
|
|
16306
15643
|
* @example
|
|
16307
|
-
* <div modernizr='webgl'>
|
|
16308
|
-
* <code>
|
|
16309
15644
|
* let img;
|
|
16310
15645
|
* let imgShader;
|
|
16311
15646
|
*
|
|
@@ -16365,12 +15700,8 @@ function material(p5, fn) {
|
|
|
16365
15700
|
* image(img, -width / 2, -height / 2, width, height);
|
|
16366
15701
|
* }
|
|
16367
15702
|
*
|
|
16368
|
-
* </code>
|
|
16369
|
-
* </div>
|
|
16370
15703
|
*
|
|
16371
15704
|
* @example
|
|
16372
|
-
* <div modernizr='webgl'>
|
|
16373
|
-
* <code>
|
|
16374
15705
|
* let img;
|
|
16375
15706
|
* let imgShader;
|
|
16376
15707
|
*
|
|
@@ -16426,8 +15757,6 @@ function material(p5, fn) {
|
|
|
16426
15757
|
* imgShader.setUniform('uTexture', img);
|
|
16427
15758
|
* image(img, -width / 2, -height / 2, width, height);
|
|
16428
15759
|
* }
|
|
16429
|
-
* </code>
|
|
16430
|
-
* </div>
|
|
16431
15760
|
*/
|
|
16432
15761
|
fn.imageShader = function (s) {
|
|
16433
15762
|
this._assert3d("imageShader");
|
|
@@ -17374,8 +16703,6 @@ function material(p5, fn) {
|
|
|
17374
16703
|
* @chainable
|
|
17375
16704
|
*
|
|
17376
16705
|
* @example
|
|
17377
|
-
* <div>
|
|
17378
|
-
* <code>
|
|
17379
16706
|
* // Create a string with the vertex shader program.
|
|
17380
16707
|
* // The vertex shader is called for each vertex.
|
|
17381
16708
|
* let vertSrc = `
|
|
@@ -17442,8 +16769,6 @@ function material(p5, fn) {
|
|
|
17442
16769
|
* box(width / 4);
|
|
17443
16770
|
* pop();
|
|
17444
16771
|
* }
|
|
17445
|
-
* </code>
|
|
17446
|
-
* </div>
|
|
17447
16772
|
*/
|
|
17448
16773
|
fn.resetShader = function () {
|
|
17449
16774
|
this._renderer.resetShader();
|
|
@@ -17476,8 +16801,6 @@ function material(p5, fn) {
|
|
|
17476
16801
|
* @chainable
|
|
17477
16802
|
*
|
|
17478
16803
|
* @example
|
|
17479
|
-
* <div>
|
|
17480
|
-
* <code>
|
|
17481
16804
|
* let img;
|
|
17482
16805
|
*
|
|
17483
16806
|
* async function setup() {
|
|
@@ -17503,11 +16826,8 @@ function material(p5, fn) {
|
|
|
17503
16826
|
* // Draw the box.
|
|
17504
16827
|
* box(50);
|
|
17505
16828
|
* }
|
|
17506
|
-
* </code>
|
|
17507
|
-
* </div>
|
|
17508
16829
|
*
|
|
17509
|
-
*
|
|
17510
|
-
* <code>
|
|
16830
|
+
* @example
|
|
17511
16831
|
* let pg;
|
|
17512
16832
|
*
|
|
17513
16833
|
* function setup() {
|
|
@@ -17537,11 +16857,8 @@ function material(p5, fn) {
|
|
|
17537
16857
|
* // Draw the box.
|
|
17538
16858
|
* box(50);
|
|
17539
16859
|
* }
|
|
17540
|
-
* </code>
|
|
17541
|
-
* </div>
|
|
17542
16860
|
*
|
|
17543
|
-
*
|
|
17544
|
-
* <code>
|
|
16861
|
+
* @example
|
|
17545
16862
|
* let vid;
|
|
17546
16863
|
*
|
|
17547
16864
|
* function setup() {
|
|
@@ -17571,11 +16888,8 @@ function material(p5, fn) {
|
|
|
17571
16888
|
* // Draw the rectangle.
|
|
17572
16889
|
* rect(-40, -40, 80, 80);
|
|
17573
16890
|
* }
|
|
17574
|
-
* </code>
|
|
17575
|
-
* </div>
|
|
17576
16891
|
*
|
|
17577
|
-
*
|
|
17578
|
-
* <code>
|
|
16892
|
+
* @example
|
|
17579
16893
|
* let vid;
|
|
17580
16894
|
*
|
|
17581
16895
|
* function setup() {
|
|
@@ -17613,8 +16927,6 @@ function material(p5, fn) {
|
|
|
17613
16927
|
* vertex(-40, 40, 0, 1);
|
|
17614
16928
|
* endShape();
|
|
17615
16929
|
* }
|
|
17616
|
-
* </code>
|
|
17617
|
-
* </div>
|
|
17618
16930
|
*/
|
|
17619
16931
|
fn.texture = function (tex) {
|
|
17620
16932
|
this._assert3d("texture");
|
|
@@ -17730,8 +17042,6 @@ function material(p5, fn) {
|
|
|
17730
17042
|
* @param {(IMAGE|NORMAL)} mode either IMAGE or NORMAL.
|
|
17731
17043
|
*
|
|
17732
17044
|
* @example
|
|
17733
|
-
* <div>
|
|
17734
|
-
* <code>
|
|
17735
17045
|
* let img;
|
|
17736
17046
|
*
|
|
17737
17047
|
* async function setup() {
|
|
@@ -17758,11 +17068,8 @@ function material(p5, fn) {
|
|
|
17758
17068
|
* vertex(-30, 30, 0, img.height);
|
|
17759
17069
|
* endShape();
|
|
17760
17070
|
* }
|
|
17761
|
-
* </code>
|
|
17762
|
-
* </div>
|
|
17763
17071
|
*
|
|
17764
|
-
*
|
|
17765
|
-
* <code>
|
|
17072
|
+
* @example
|
|
17766
17073
|
* let img;
|
|
17767
17074
|
*
|
|
17768
17075
|
* async function setup() {
|
|
@@ -17792,8 +17099,6 @@ function material(p5, fn) {
|
|
|
17792
17099
|
* vertex(-30, 30, 0, 1);
|
|
17793
17100
|
* endShape();
|
|
17794
17101
|
* }
|
|
17795
|
-
* </code>
|
|
17796
|
-
* </div>
|
|
17797
17102
|
*/
|
|
17798
17103
|
fn.textureMode = function (mode) {
|
|
17799
17104
|
if (mode !== IMAGE && mode !== NORMAL) {
|
|
@@ -17908,8 +17213,6 @@ function material(p5, fn) {
|
|
|
17908
17213
|
* @param {(CLAMP|REPEAT|MIRROR)} [wrapY=wrapX] either CLAMP, REPEAT, or MIRROR
|
|
17909
17214
|
*
|
|
17910
17215
|
* @example
|
|
17911
|
-
* <div>
|
|
17912
|
-
* <code>
|
|
17913
17216
|
* let img;
|
|
17914
17217
|
*
|
|
17915
17218
|
* async function setup() {
|
|
@@ -17947,11 +17250,8 @@ function material(p5, fn) {
|
|
|
17947
17250
|
* vertex(-30, 30, 0, 0, 2);
|
|
17948
17251
|
* endShape();
|
|
17949
17252
|
* }
|
|
17950
|
-
* </code>
|
|
17951
|
-
* </div>
|
|
17952
17253
|
*
|
|
17953
|
-
*
|
|
17954
|
-
* <code>
|
|
17254
|
+
* @example
|
|
17955
17255
|
* let img;
|
|
17956
17256
|
*
|
|
17957
17257
|
* async function setup() {
|
|
@@ -17986,11 +17286,8 @@ function material(p5, fn) {
|
|
|
17986
17286
|
* vertex(-30, 30, 0, 0, 2);
|
|
17987
17287
|
* endShape();
|
|
17988
17288
|
* }
|
|
17989
|
-
* </code>
|
|
17990
|
-
* </div>
|
|
17991
17289
|
*
|
|
17992
|
-
*
|
|
17993
|
-
* <code>
|
|
17290
|
+
* @example
|
|
17994
17291
|
* let img;
|
|
17995
17292
|
*
|
|
17996
17293
|
* async function setup() {
|
|
@@ -18027,11 +17324,8 @@ function material(p5, fn) {
|
|
|
18027
17324
|
* vertex(-30, 30, 0, 0, 2);
|
|
18028
17325
|
* endShape();
|
|
18029
17326
|
* }
|
|
18030
|
-
* </code>
|
|
18031
|
-
* </div>
|
|
18032
17327
|
*
|
|
18033
|
-
*
|
|
18034
|
-
* <code>
|
|
17328
|
+
* @example
|
|
18035
17329
|
* let img;
|
|
18036
17330
|
*
|
|
18037
17331
|
* async function setup() {
|
|
@@ -18068,8 +17362,6 @@ function material(p5, fn) {
|
|
|
18068
17362
|
* vertex(-30, 30, 0, 0, 2);
|
|
18069
17363
|
* endShape();
|
|
18070
17364
|
* }
|
|
18071
|
-
* </code>
|
|
18072
|
-
* </div>
|
|
18073
17365
|
*/
|
|
18074
17366
|
fn.textureWrap = function (wrapX, wrapY = wrapX) {
|
|
18075
17367
|
this._renderer.states.setValue("textureWrapX", wrapX);
|
|
@@ -18093,8 +17385,6 @@ function material(p5, fn) {
|
|
|
18093
17385
|
* @chainable
|
|
18094
17386
|
*
|
|
18095
17387
|
* @example
|
|
18096
|
-
* <div>
|
|
18097
|
-
* <code>
|
|
18098
17388
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18099
17389
|
*
|
|
18100
17390
|
* function setup() {
|
|
@@ -18115,8 +17405,6 @@ function material(p5, fn) {
|
|
|
18115
17405
|
* // Draw the torus.
|
|
18116
17406
|
* torus(30);
|
|
18117
17407
|
* }
|
|
18118
|
-
* </code>
|
|
18119
|
-
* </div>
|
|
18120
17408
|
*/
|
|
18121
17409
|
fn.normalMaterial = function (...args) {
|
|
18122
17410
|
this._assert3d("normalMaterial");
|
|
@@ -18165,8 +17453,6 @@ function material(p5, fn) {
|
|
|
18165
17453
|
* @chainable
|
|
18166
17454
|
*
|
|
18167
17455
|
* @example
|
|
18168
|
-
* <div>
|
|
18169
|
-
* <code>
|
|
18170
17456
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18171
17457
|
*
|
|
18172
17458
|
* function setup() {
|
|
@@ -18187,11 +17473,8 @@ function material(p5, fn) {
|
|
|
18187
17473
|
* // Draw the box.
|
|
18188
17474
|
* box();
|
|
18189
17475
|
* }
|
|
18190
|
-
* </code>
|
|
18191
|
-
* </div>
|
|
18192
17476
|
*
|
|
18193
|
-
*
|
|
18194
|
-
* <code>
|
|
17477
|
+
* @example
|
|
18195
17478
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18196
17479
|
*
|
|
18197
17480
|
* function setup() {
|
|
@@ -18215,11 +17498,8 @@ function material(p5, fn) {
|
|
|
18215
17498
|
* // Draw the box.
|
|
18216
17499
|
* box();
|
|
18217
17500
|
* }
|
|
18218
|
-
* </code>
|
|
18219
|
-
* </div>
|
|
18220
17501
|
*
|
|
18221
|
-
*
|
|
18222
|
-
* <code>
|
|
17502
|
+
* @example
|
|
18223
17503
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18224
17504
|
*
|
|
18225
17505
|
* function setup() {
|
|
@@ -18243,11 +17523,8 @@ function material(p5, fn) {
|
|
|
18243
17523
|
* // Draw the box.
|
|
18244
17524
|
* box();
|
|
18245
17525
|
* }
|
|
18246
|
-
* </code>
|
|
18247
|
-
* </div>
|
|
18248
17526
|
*
|
|
18249
|
-
*
|
|
18250
|
-
* <code>
|
|
17527
|
+
* @example
|
|
18251
17528
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18252
17529
|
*
|
|
18253
17530
|
* function setup() {
|
|
@@ -18272,11 +17549,8 @@ function material(p5, fn) {
|
|
|
18272
17549
|
* // Draw the box.
|
|
18273
17550
|
* box();
|
|
18274
17551
|
* }
|
|
18275
|
-
* </code>
|
|
18276
|
-
* </div>
|
|
18277
17552
|
*
|
|
18278
|
-
*
|
|
18279
|
-
* <code>
|
|
17553
|
+
* @example
|
|
18280
17554
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18281
17555
|
*
|
|
18282
17556
|
* function setup() {
|
|
@@ -18300,11 +17574,8 @@ function material(p5, fn) {
|
|
|
18300
17574
|
* // Draw the box.
|
|
18301
17575
|
* box();
|
|
18302
17576
|
* }
|
|
18303
|
-
* </code>
|
|
18304
|
-
* </div>
|
|
18305
17577
|
*
|
|
18306
|
-
*
|
|
18307
|
-
* <code>
|
|
17578
|
+
* @example
|
|
18308
17579
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18309
17580
|
*
|
|
18310
17581
|
* function setup() {
|
|
@@ -18328,16 +17599,12 @@ function material(p5, fn) {
|
|
|
18328
17599
|
* // Draw the box.
|
|
18329
17600
|
* box();
|
|
18330
17601
|
* }
|
|
18331
|
-
* </code>
|
|
18332
|
-
* </div>
|
|
18333
17602
|
*/
|
|
18334
|
-
|
|
18335
17603
|
/**
|
|
18336
17604
|
* @method ambientMaterial
|
|
18337
17605
|
* @param {Number} gray grayscale value between 0 (black) and 255 (white).
|
|
18338
17606
|
* @chainable
|
|
18339
17607
|
*/
|
|
18340
|
-
|
|
18341
17608
|
/**
|
|
18342
17609
|
* @method ambientMaterial
|
|
18343
17610
|
* @param {p5.Color|Number[]|String} color
|
|
@@ -18401,8 +17668,6 @@ function material(p5, fn) {
|
|
|
18401
17668
|
* @chainable
|
|
18402
17669
|
*
|
|
18403
17670
|
* @example
|
|
18404
|
-
* <div>
|
|
18405
|
-
* <code>
|
|
18406
17671
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18407
17672
|
*
|
|
18408
17673
|
* function setup() {
|
|
@@ -18426,16 +17691,12 @@ function material(p5, fn) {
|
|
|
18426
17691
|
* // Draw the box.
|
|
18427
17692
|
* box();
|
|
18428
17693
|
* }
|
|
18429
|
-
* </code>
|
|
18430
|
-
* </div>
|
|
18431
17694
|
*/
|
|
18432
|
-
|
|
18433
17695
|
/**
|
|
18434
17696
|
* @method emissiveMaterial
|
|
18435
17697
|
* @param {Number} gray grayscale value between 0 (black) and 255 (white).
|
|
18436
17698
|
* @chainable
|
|
18437
17699
|
*/
|
|
18438
|
-
|
|
18439
17700
|
/**
|
|
18440
17701
|
* @method emissiveMaterial
|
|
18441
17702
|
* @param {p5.Color|Number[]|String} color
|
|
@@ -18498,8 +17759,6 @@ function material(p5, fn) {
|
|
|
18498
17759
|
* @chainable
|
|
18499
17760
|
*
|
|
18500
17761
|
* @example
|
|
18501
|
-
* <div>
|
|
18502
|
-
* <code>
|
|
18503
17762
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18504
17763
|
* // Double-click the canvas to apply a specular material.
|
|
18505
17764
|
*
|
|
@@ -18538,11 +17797,8 @@ function material(p5, fn) {
|
|
|
18538
17797
|
* function doubleClicked() {
|
|
18539
17798
|
* isGlossy = true;
|
|
18540
17799
|
* }
|
|
18541
|
-
* </code>
|
|
18542
|
-
* </div>
|
|
18543
17800
|
*
|
|
18544
|
-
*
|
|
18545
|
-
* <code>
|
|
17801
|
+
* @example
|
|
18546
17802
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18547
17803
|
* // Double-click the canvas to apply a specular material.
|
|
18548
17804
|
*
|
|
@@ -18583,11 +17839,8 @@ function material(p5, fn) {
|
|
|
18583
17839
|
* function doubleClicked() {
|
|
18584
17840
|
* isGlossy = true;
|
|
18585
17841
|
* }
|
|
18586
|
-
* </code>
|
|
18587
|
-
* </div>
|
|
18588
17842
|
*
|
|
18589
|
-
*
|
|
18590
|
-
* <code>
|
|
17843
|
+
* @example
|
|
18591
17844
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18592
17845
|
* // Double-click the canvas to apply a specular material.
|
|
18593
17846
|
*
|
|
@@ -18630,11 +17883,8 @@ function material(p5, fn) {
|
|
|
18630
17883
|
* function doubleClicked() {
|
|
18631
17884
|
* isGlossy = true;
|
|
18632
17885
|
* }
|
|
18633
|
-
* </code>
|
|
18634
|
-
* </div>
|
|
18635
17886
|
*
|
|
18636
|
-
*
|
|
18637
|
-
* <code>
|
|
17887
|
+
* @example
|
|
18638
17888
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18639
17889
|
* // Double-click the canvas to apply a specular material.
|
|
18640
17890
|
*
|
|
@@ -18675,10 +17925,7 @@ function material(p5, fn) {
|
|
|
18675
17925
|
* function doubleClicked() {
|
|
18676
17926
|
* isGlossy = true;
|
|
18677
17927
|
* }
|
|
18678
|
-
* </code>
|
|
18679
|
-
* </div>
|
|
18680
17928
|
*/
|
|
18681
|
-
|
|
18682
17929
|
/**
|
|
18683
17930
|
* @method specularMaterial
|
|
18684
17931
|
* @param {Number} v1 red or hue value in
|
|
@@ -18690,7 +17937,6 @@ function material(p5, fn) {
|
|
|
18690
17937
|
* @param {Number} [alpha]
|
|
18691
17938
|
* @chainable
|
|
18692
17939
|
*/
|
|
18693
|
-
|
|
18694
17940
|
/**
|
|
18695
17941
|
* @method specularMaterial
|
|
18696
17942
|
* @param {p5.Color|Number[]|String} color
|
|
@@ -18729,8 +17975,6 @@ function material(p5, fn) {
|
|
|
18729
17975
|
* @chainable
|
|
18730
17976
|
*
|
|
18731
17977
|
* @example
|
|
18732
|
-
* <div>
|
|
18733
|
-
* <code>
|
|
18734
17978
|
* function setup() {
|
|
18735
17979
|
* createCanvas(100, 100, WEBGL);
|
|
18736
17980
|
*
|
|
@@ -18768,8 +18012,6 @@ function material(p5, fn) {
|
|
|
18768
18012
|
* shininess(100);
|
|
18769
18013
|
* sphere(20);
|
|
18770
18014
|
* }
|
|
18771
|
-
* </code>
|
|
18772
|
-
* </div>
|
|
18773
18015
|
*/
|
|
18774
18016
|
fn.shininess = function (shine) {
|
|
18775
18017
|
this._assert3d("shininess");
|
|
@@ -18801,8 +18043,6 @@ function material(p5, fn) {
|
|
|
18801
18043
|
* @param {Number} metallic amount of metalness.
|
|
18802
18044
|
*
|
|
18803
18045
|
* @example
|
|
18804
|
-
* <div>
|
|
18805
|
-
* <code>
|
|
18806
18046
|
* function setup() {
|
|
18807
18047
|
* createCanvas(100, 100, WEBGL);
|
|
18808
18048
|
*
|
|
@@ -18840,11 +18080,8 @@ function material(p5, fn) {
|
|
|
18840
18080
|
* metalness(50);
|
|
18841
18081
|
* sphere(20);
|
|
18842
18082
|
* }
|
|
18843
|
-
* </code>
|
|
18844
|
-
* </div>
|
|
18845
18083
|
*
|
|
18846
|
-
*
|
|
18847
|
-
* <code>
|
|
18084
|
+
* @example
|
|
18848
18085
|
* // Click and drag the mouse to view the scene from different angles.
|
|
18849
18086
|
*
|
|
18850
18087
|
* let img;
|
|
@@ -18884,8 +18121,6 @@ function material(p5, fn) {
|
|
|
18884
18121
|
* metalness(50);
|
|
18885
18122
|
* sphere(20);
|
|
18886
18123
|
* }
|
|
18887
|
-
* </code>
|
|
18888
|
-
* </div>
|
|
18889
18124
|
*/
|
|
18890
18125
|
fn.metalness = function (metallic) {
|
|
18891
18126
|
this._assert3d("metalness");
|
|
@@ -19038,10 +18273,7 @@ class Graphics {
|
|
|
19038
18273
|
* values each time <a href="#/p5/draw">draw()</a> executes. `p5.Graphics`
|
|
19039
18274
|
* objects must reset these values manually by calling `myGraphics.reset()`.
|
|
19040
18275
|
*
|
|
19041
|
-
*
|
|
19042
18276
|
* @example
|
|
19043
|
-
* <div>
|
|
19044
|
-
* <code>
|
|
19045
18277
|
* let pg;
|
|
19046
18278
|
*
|
|
19047
18279
|
* function setup() {
|
|
@@ -19078,11 +18310,8 @@ class Graphics {
|
|
|
19078
18310
|
* pg.reset();
|
|
19079
18311
|
* }
|
|
19080
18312
|
* }
|
|
19081
|
-
* </code>
|
|
19082
|
-
* </div>
|
|
19083
18313
|
*
|
|
19084
|
-
*
|
|
19085
|
-
* <code>
|
|
18314
|
+
* @example
|
|
19086
18315
|
* let pg;
|
|
19087
18316
|
*
|
|
19088
18317
|
* function setup() {
|
|
@@ -19110,11 +18339,8 @@ class Graphics {
|
|
|
19110
18339
|
* // Reset the p5.Graphics object automatically.
|
|
19111
18340
|
* pg.reset();
|
|
19112
18341
|
* }
|
|
19113
|
-
* </code>
|
|
19114
|
-
* </div>
|
|
19115
18342
|
*
|
|
19116
|
-
*
|
|
19117
|
-
* <code>
|
|
18343
|
+
* @example
|
|
19118
18344
|
* let pg;
|
|
19119
18345
|
*
|
|
19120
18346
|
* function setup() {
|
|
@@ -19151,11 +18377,8 @@ class Graphics {
|
|
|
19151
18377
|
* pg.reset();
|
|
19152
18378
|
* }
|
|
19153
18379
|
* }
|
|
19154
|
-
* </code>
|
|
19155
|
-
* </div>
|
|
19156
18380
|
*
|
|
19157
|
-
*
|
|
19158
|
-
* <code>
|
|
18381
|
+
* @example
|
|
19159
18382
|
* let pg;
|
|
19160
18383
|
*
|
|
19161
18384
|
* function setup() {
|
|
@@ -19187,8 +18410,6 @@ class Graphics {
|
|
|
19187
18410
|
* // Reset the p5.Graphics object automatically.
|
|
19188
18411
|
* pg.reset();
|
|
19189
18412
|
* }
|
|
19190
|
-
* </code>
|
|
19191
|
-
* </div>
|
|
19192
18413
|
*/
|
|
19193
18414
|
reset() {
|
|
19194
18415
|
this._renderer.resetMatrix();
|
|
@@ -19218,8 +18439,6 @@ class Graphics {
|
|
|
19218
18439
|
* collected.
|
|
19219
18440
|
*
|
|
19220
18441
|
* @example
|
|
19221
|
-
* <div>
|
|
19222
|
-
* <code>
|
|
19223
18442
|
* // Double-click to remove the p5.Graphics object.
|
|
19224
18443
|
*
|
|
19225
18444
|
* let pg;
|
|
@@ -19254,15 +18473,12 @@ class Graphics {
|
|
|
19254
18473
|
* pg.remove();
|
|
19255
18474
|
* pg = undefined;
|
|
19256
18475
|
* }
|
|
19257
|
-
* </code>
|
|
19258
|
-
* </div>
|
|
19259
18476
|
*/
|
|
19260
18477
|
remove() {
|
|
19261
18478
|
this._renderer.remove();
|
|
19262
18479
|
this._renderer = undefined;
|
|
19263
18480
|
}
|
|
19264
18481
|
|
|
19265
|
-
|
|
19266
18482
|
/**
|
|
19267
18483
|
* Creates a new <a href="#/p5.Framebuffer">p5.Framebuffer</a> object with
|
|
19268
18484
|
* the same WebGL context as the graphics buffer.
|
|
@@ -19306,8 +18522,6 @@ class Graphics {
|
|
|
19306
18522
|
* @return {p5.Framebuffer} new framebuffer.
|
|
19307
18523
|
*
|
|
19308
18524
|
* @example
|
|
19309
|
-
* <div>
|
|
19310
|
-
* <code>
|
|
19311
18525
|
* // Click and hold a mouse button to change shapes.
|
|
19312
18526
|
*
|
|
19313
18527
|
* let pg;
|
|
@@ -19405,11 +18619,8 @@ class Graphics {
|
|
|
19405
18619
|
* // Start drawing to the box p5.Framebuffer.
|
|
19406
18620
|
* boxLayer.end();
|
|
19407
18621
|
* }
|
|
19408
|
-
* </code>
|
|
19409
|
-
* </div>
|
|
19410
18622
|
*
|
|
19411
|
-
*
|
|
19412
|
-
* <code>
|
|
18623
|
+
* @example
|
|
19413
18624
|
* // Click and hold a mouse button to change shapes.
|
|
19414
18625
|
*
|
|
19415
18626
|
* let pg;
|
|
@@ -19511,8 +18722,6 @@ class Graphics {
|
|
|
19511
18722
|
* // Start drawing to the box p5.Framebuffer.
|
|
19512
18723
|
* boxLayer.end();
|
|
19513
18724
|
* }
|
|
19514
|
-
* </code>
|
|
19515
|
-
* </div>
|
|
19516
18725
|
*/
|
|
19517
18726
|
createFramebuffer(options) {
|
|
19518
18727
|
return new Framebuffer(this._renderer, options);
|
|
@@ -19572,8 +18781,6 @@ function graphics(p5, fn){
|
|
|
19572
18781
|
* @param {HTMLCanvasElement} [canvas] existing `<canvas>` element to use.
|
|
19573
18782
|
*
|
|
19574
18783
|
* @example
|
|
19575
|
-
* <div>
|
|
19576
|
-
* <code>
|
|
19577
18784
|
* let pg;
|
|
19578
18785
|
*
|
|
19579
18786
|
* function setup() {
|
|
@@ -19595,11 +18802,8 @@ function graphics(p5, fn){
|
|
|
19595
18802
|
* // Display the p5.Graphics object.
|
|
19596
18803
|
* image(pg, 25, 25);
|
|
19597
18804
|
* }
|
|
19598
|
-
* </code>
|
|
19599
|
-
* </div>
|
|
19600
18805
|
*
|
|
19601
|
-
*
|
|
19602
|
-
* <code>
|
|
18806
|
+
* @example
|
|
19603
18807
|
* // Click the canvas to display the graphics buffer.
|
|
19604
18808
|
*
|
|
19605
18809
|
* let pg;
|
|
@@ -19628,8 +18832,6 @@ function graphics(p5, fn){
|
|
|
19628
18832
|
* image(pg, 25, 25);
|
|
19629
18833
|
* }
|
|
19630
18834
|
* }
|
|
19631
|
-
* </code>
|
|
19632
|
-
* </div>
|
|
19633
18835
|
*/
|
|
19634
18836
|
p5.Graphics = Graphics;
|
|
19635
18837
|
|
|
@@ -20676,8 +19878,6 @@ class Framebuffer {
|
|
|
20676
19878
|
* @param {Number} height height of the framebuffer.
|
|
20677
19879
|
*
|
|
20678
19880
|
* @example
|
|
20679
|
-
* <div>
|
|
20680
|
-
* <code>
|
|
20681
19881
|
* let myBuffer;
|
|
20682
19882
|
*
|
|
20683
19883
|
* function setup() {
|
|
@@ -20708,8 +19908,6 @@ class Framebuffer {
|
|
|
20708
19908
|
* function mouseMoved() {
|
|
20709
19909
|
* myBuffer.resize(mouseX, mouseY);
|
|
20710
19910
|
* }
|
|
20711
|
-
* </code>
|
|
20712
|
-
* </div>
|
|
20713
19911
|
*/
|
|
20714
19912
|
resize(width, height) {
|
|
20715
19913
|
this._autoSized = false;
|
|
@@ -20743,8 +19941,6 @@ class Framebuffer {
|
|
|
20743
19941
|
* @returns {Number} current pixel density.
|
|
20744
19942
|
*
|
|
20745
19943
|
* @example
|
|
20746
|
-
* <div>
|
|
20747
|
-
* <code>
|
|
20748
19944
|
* let myBuffer;
|
|
20749
19945
|
*
|
|
20750
19946
|
* function setup() {
|
|
@@ -20778,11 +19974,8 @@ class Framebuffer {
|
|
|
20778
19974
|
* function mouseReleased() {
|
|
20779
19975
|
* myBuffer.pixelDensity(2);
|
|
20780
19976
|
* }
|
|
20781
|
-
* </code>
|
|
20782
|
-
* </div>
|
|
20783
19977
|
*
|
|
20784
|
-
*
|
|
20785
|
-
* <code>
|
|
19978
|
+
* @example
|
|
20786
19979
|
* let myBuffer;
|
|
20787
19980
|
* let myFont;
|
|
20788
19981
|
*
|
|
@@ -20811,8 +20004,6 @@ class Framebuffer {
|
|
|
20811
20004
|
*
|
|
20812
20005
|
* describe(`The text "Density: ${d}" written in black on a gray background.`);
|
|
20813
20006
|
* }
|
|
20814
|
-
* </code>
|
|
20815
|
-
* </div>
|
|
20816
20007
|
*/
|
|
20817
20008
|
pixelDensity(density) {
|
|
20818
20009
|
if (density) {
|
|
@@ -20838,8 +20029,6 @@ class Framebuffer {
|
|
|
20838
20029
|
* @returns {Boolean} current autosize setting.
|
|
20839
20030
|
*
|
|
20840
20031
|
* @example
|
|
20841
|
-
* <div>
|
|
20842
|
-
* <code>
|
|
20843
20032
|
* // Double-click to toggle the autosizing mode.
|
|
20844
20033
|
*
|
|
20845
20034
|
* let myBuffer;
|
|
@@ -20880,8 +20069,6 @@ class Framebuffer {
|
|
|
20880
20069
|
* let isAuto = myBuffer.autoSized();
|
|
20881
20070
|
* myBuffer.autoSized(!isAuto);
|
|
20882
20071
|
* }
|
|
20883
|
-
* </code>
|
|
20884
|
-
* </div>
|
|
20885
20072
|
*/
|
|
20886
20073
|
autoSized(autoSized) {
|
|
20887
20074
|
if (autoSized === undefined) {
|
|
@@ -21120,8 +20307,6 @@ class Framebuffer {
|
|
|
21120
20307
|
* @returns {p5.Camera} new camera.
|
|
21121
20308
|
*
|
|
21122
20309
|
* @example
|
|
21123
|
-
* <div>
|
|
21124
|
-
* <code>
|
|
21125
20310
|
* // Double-click to toggle between cameras.
|
|
21126
20311
|
*
|
|
21127
20312
|
* let myBuffer;
|
|
@@ -21188,8 +20373,6 @@ class Framebuffer {
|
|
|
21188
20373
|
* usingCam1 = true;
|
|
21189
20374
|
* }
|
|
21190
20375
|
* }
|
|
21191
|
-
* </code>
|
|
21192
|
-
* </div>
|
|
21193
20376
|
*/
|
|
21194
20377
|
createCamera() {
|
|
21195
20378
|
const cam = new FramebufferCamera(this);
|
|
@@ -21219,8 +20402,6 @@ class Framebuffer {
|
|
|
21219
20402
|
* collected.
|
|
21220
20403
|
*
|
|
21221
20404
|
* @example
|
|
21222
|
-
* <div>
|
|
21223
|
-
* <code>
|
|
21224
20405
|
* // Double-click to remove the p5.Framebuffer object.
|
|
21225
20406
|
*
|
|
21226
20407
|
* let myBuffer;
|
|
@@ -21263,8 +20444,6 @@ class Framebuffer {
|
|
|
21263
20444
|
* // Delete the framebuffer from CPU memory.
|
|
21264
20445
|
* myBuffer = undefined;
|
|
21265
20446
|
* }
|
|
21266
|
-
* </code>
|
|
21267
|
-
* </div>
|
|
21268
20447
|
*/
|
|
21269
20448
|
remove() {
|
|
21270
20449
|
this._deleteTextures();
|
|
@@ -21286,8 +20465,6 @@ class Framebuffer {
|
|
|
21286
20465
|
* as an image or texture.
|
|
21287
20466
|
*
|
|
21288
20467
|
* @example
|
|
21289
|
-
* <div>
|
|
21290
|
-
* <code>
|
|
21291
20468
|
* let myBuffer;
|
|
21292
20469
|
*
|
|
21293
20470
|
* function setup() {
|
|
@@ -21319,8 +20496,6 @@ class Framebuffer {
|
|
|
21319
20496
|
* image(myBuffer, -50, -50);
|
|
21320
20497
|
* }
|
|
21321
20498
|
* }
|
|
21322
|
-
* </code>
|
|
21323
|
-
* </div>
|
|
21324
20499
|
*/
|
|
21325
20500
|
begin() {
|
|
21326
20501
|
this.prevFramebuffer = this.renderer.activeFramebuffer();
|
|
@@ -21417,8 +20592,6 @@ class Framebuffer {
|
|
|
21417
20592
|
* or texture.
|
|
21418
20593
|
*
|
|
21419
20594
|
* @example
|
|
21420
|
-
* <div>
|
|
21421
|
-
* <code>
|
|
21422
20595
|
* let myBuffer;
|
|
21423
20596
|
*
|
|
21424
20597
|
* function setup() {
|
|
@@ -21450,8 +20623,6 @@ class Framebuffer {
|
|
|
21450
20623
|
* image(myBuffer, -50, -50);
|
|
21451
20624
|
* }
|
|
21452
20625
|
* }
|
|
21453
|
-
* </code>
|
|
21454
|
-
* </div>
|
|
21455
20626
|
*/
|
|
21456
20627
|
end() {
|
|
21457
20628
|
this.renderer.pop();
|
|
@@ -21491,8 +20662,6 @@ class Framebuffer {
|
|
|
21491
20662
|
* @param {Function} callback function that draws to the framebuffer.
|
|
21492
20663
|
*
|
|
21493
20664
|
* @example
|
|
21494
|
-
* <div>
|
|
21495
|
-
* <code>
|
|
21496
20665
|
* // Click the canvas to display the framebuffer.
|
|
21497
20666
|
*
|
|
21498
20667
|
* let myBuffer;
|
|
@@ -21526,8 +20695,6 @@ class Framebuffer {
|
|
|
21526
20695
|
* normalMaterial();
|
|
21527
20696
|
* torus(30);
|
|
21528
20697
|
* }
|
|
21529
|
-
* </code>
|
|
21530
|
-
* </div>
|
|
21531
20698
|
*/
|
|
21532
20699
|
draw(callback) {
|
|
21533
20700
|
this.begin();
|
|
@@ -21543,8 +20710,6 @@ class Framebuffer {
|
|
|
21543
20710
|
* <a href="#/p5.Framebuffer/pixels">myBuffer.pixels</a>.
|
|
21544
20711
|
*
|
|
21545
20712
|
* @example
|
|
21546
|
-
* <div>
|
|
21547
|
-
* <code>
|
|
21548
20713
|
* function setup() {
|
|
21549
20714
|
* createCanvas(100, 100, WEBGL);
|
|
21550
20715
|
*
|
|
@@ -21576,8 +20741,6 @@ class Framebuffer {
|
|
|
21576
20741
|
*
|
|
21577
20742
|
* describe('A pink rectangle above a gray rectangle.');
|
|
21578
20743
|
* }
|
|
21579
|
-
* </code>
|
|
21580
|
-
* </div>
|
|
21581
20744
|
*/
|
|
21582
20745
|
loadPixels() {
|
|
21583
20746
|
this._update('colorTexture');
|
|
@@ -21673,8 +20836,6 @@ class Framebuffer {
|
|
|
21673
20836
|
* @method updatePixels
|
|
21674
20837
|
*
|
|
21675
20838
|
* @example
|
|
21676
|
-
* <div>
|
|
21677
|
-
* <code>
|
|
21678
20839
|
* function setup() {
|
|
21679
20840
|
* createCanvas(100, 100, WEBGL);
|
|
21680
20841
|
*
|
|
@@ -21706,8 +20867,6 @@ class Framebuffer {
|
|
|
21706
20867
|
*
|
|
21707
20868
|
* describe('A pink rectangle above a gray rectangle.');
|
|
21708
20869
|
* }
|
|
21709
|
-
* </code>
|
|
21710
|
-
* </div>
|
|
21711
20870
|
*/
|
|
21712
20871
|
updatePixels() {
|
|
21713
20872
|
// Let renderer handle the pixel update process
|
|
@@ -21790,8 +20949,6 @@ function framebuffer(p5, fn){
|
|
|
21790
20949
|
* @for p5.Framebuffer
|
|
21791
20950
|
*
|
|
21792
20951
|
* @example
|
|
21793
|
-
* <div>
|
|
21794
|
-
* <code>
|
|
21795
20952
|
* function setup() {
|
|
21796
20953
|
* createCanvas(100, 100, WEBGL);
|
|
21797
20954
|
*
|
|
@@ -21819,8 +20976,6 @@ function framebuffer(p5, fn){
|
|
|
21819
20976
|
*
|
|
21820
20977
|
* describe('A white triangle on a gray background.');
|
|
21821
20978
|
* }
|
|
21822
|
-
* </code>
|
|
21823
|
-
* </div>
|
|
21824
20979
|
*/
|
|
21825
20980
|
|
|
21826
20981
|
/**
|
|
@@ -21843,8 +20998,6 @@ function framebuffer(p5, fn){
|
|
|
21843
20998
|
* @for p5.Framebuffer
|
|
21844
20999
|
*
|
|
21845
21000
|
* @example
|
|
21846
|
-
* <div>
|
|
21847
|
-
* <code>
|
|
21848
21001
|
* // Note: A "uniform" is a global variable within a shader program.
|
|
21849
21002
|
*
|
|
21850
21003
|
* // Create a string with the vertex shader program.
|
|
@@ -21919,8 +21072,6 @@ function framebuffer(p5, fn){
|
|
|
21919
21072
|
* // Draw the plane.
|
|
21920
21073
|
* plane(myBuffer.width, myBuffer.height);
|
|
21921
21074
|
* }
|
|
21922
|
-
* </code>
|
|
21923
|
-
* </div>
|
|
21924
21075
|
*/
|
|
21925
21076
|
|
|
21926
21077
|
/**
|
|
@@ -21940,8 +21091,6 @@ function framebuffer(p5, fn){
|
|
|
21940
21091
|
* @for p5.Framebuffer
|
|
21941
21092
|
*
|
|
21942
21093
|
* @example
|
|
21943
|
-
* <div>
|
|
21944
|
-
* <code>
|
|
21945
21094
|
* function setup() {
|
|
21946
21095
|
* createCanvas(100, 100, WEBGL);
|
|
21947
21096
|
*
|
|
@@ -21973,8 +21122,6 @@ function framebuffer(p5, fn){
|
|
|
21973
21122
|
*
|
|
21974
21123
|
* describe('A pink rectangle above a gray rectangle.');
|
|
21975
21124
|
* }
|
|
21976
|
-
* </code>
|
|
21977
|
-
* </div>
|
|
21978
21125
|
*/
|
|
21979
21126
|
|
|
21980
21127
|
/**
|
|
@@ -22049,8 +21196,6 @@ function rendering(p5, fn){
|
|
|
22049
21196
|
* @return {p5.Renderer} new `p5.Renderer` that holds the canvas.
|
|
22050
21197
|
*
|
|
22051
21198
|
* @example
|
|
22052
|
-
* <div>
|
|
22053
|
-
* <code>
|
|
22054
21199
|
* function setup() {
|
|
22055
21200
|
* createCanvas(100, 100);
|
|
22056
21201
|
*
|
|
@@ -22061,11 +21206,8 @@ function rendering(p5, fn){
|
|
|
22061
21206
|
*
|
|
22062
21207
|
* describe('A diagonal line drawn from top-left to bottom-right on a gray background.');
|
|
22063
21208
|
* }
|
|
22064
|
-
* </code>
|
|
22065
|
-
* </div>
|
|
22066
21209
|
*
|
|
22067
|
-
*
|
|
22068
|
-
* <code>
|
|
21210
|
+
* @example
|
|
22069
21211
|
* function setup() {
|
|
22070
21212
|
* createCanvas(100, 50);
|
|
22071
21213
|
*
|
|
@@ -22076,11 +21218,8 @@ function rendering(p5, fn){
|
|
|
22076
21218
|
*
|
|
22077
21219
|
* describe('A diagonal line drawn from top-left to bottom-right on a gray background.');
|
|
22078
21220
|
* }
|
|
22079
|
-
* </code>
|
|
22080
|
-
* </div>
|
|
22081
21221
|
*
|
|
22082
|
-
*
|
|
22083
|
-
* <code>
|
|
21222
|
+
* @example
|
|
22084
21223
|
* // Use WebGL mode.
|
|
22085
21224
|
*
|
|
22086
21225
|
* function setup() {
|
|
@@ -22093,11 +21232,8 @@ function rendering(p5, fn){
|
|
|
22093
21232
|
*
|
|
22094
21233
|
* describe('A diagonal line drawn from top-left to bottom-right on a gray background.');
|
|
22095
21234
|
* }
|
|
22096
|
-
* </code>
|
|
22097
|
-
* </div>
|
|
22098
21235
|
*
|
|
22099
|
-
*
|
|
22100
|
-
* <code>
|
|
21236
|
+
* @example
|
|
22101
21237
|
* function setup() {
|
|
22102
21238
|
* // Create a p5.Render object.
|
|
22103
21239
|
* let cnv = createCanvas(50, 50);
|
|
@@ -22112,8 +21248,6 @@ function rendering(p5, fn){
|
|
|
22112
21248
|
*
|
|
22113
21249
|
* describe('A diagonal line drawn from top-left to bottom-right on a gray background.');
|
|
22114
21250
|
* }
|
|
22115
|
-
* </code>
|
|
22116
|
-
* </div>
|
|
22117
21251
|
*/
|
|
22118
21252
|
/**
|
|
22119
21253
|
* @method createCanvas
|
|
@@ -22192,8 +21326,6 @@ function rendering(p5, fn){
|
|
|
22192
21326
|
* to `false`.
|
|
22193
21327
|
*
|
|
22194
21328
|
* @example
|
|
22195
|
-
* <div>
|
|
22196
|
-
* <code>
|
|
22197
21329
|
* // Double-click to resize the canvas.
|
|
22198
21330
|
*
|
|
22199
21331
|
* function setup() {
|
|
@@ -22215,11 +21347,8 @@ function rendering(p5, fn){
|
|
|
22215
21347
|
* function doubleClicked() {
|
|
22216
21348
|
* resizeCanvas(50, 50);
|
|
22217
21349
|
* }
|
|
22218
|
-
* </code>
|
|
22219
|
-
* </div>
|
|
22220
21350
|
*
|
|
22221
|
-
*
|
|
22222
|
-
* <code>
|
|
21351
|
+
* @example
|
|
22223
21352
|
* // Resize the web browser to change the canvas size.
|
|
22224
21353
|
*
|
|
22225
21354
|
* function setup() {
|
|
@@ -22239,8 +21368,6 @@ function rendering(p5, fn){
|
|
|
22239
21368
|
* function windowResized() {
|
|
22240
21369
|
* resizeCanvas(windowWidth, windowHeight);
|
|
22241
21370
|
* }
|
|
22242
|
-
* </code>
|
|
22243
|
-
* </div>
|
|
22244
21371
|
*/
|
|
22245
21372
|
fn.resizeCanvas = function (w, h, noRedraw) {
|
|
22246
21373
|
// p5._validateParameters('resizeCanvas', arguments);
|
|
@@ -22269,13 +21396,9 @@ function rendering(p5, fn){
|
|
|
22269
21396
|
* @method noCanvas
|
|
22270
21397
|
*
|
|
22271
21398
|
* @example
|
|
22272
|
-
* <div>
|
|
22273
|
-
* <code>
|
|
22274
21399
|
* function setup() {
|
|
22275
21400
|
* noCanvas();
|
|
22276
21401
|
* }
|
|
22277
|
-
* </code>
|
|
22278
|
-
* </div>
|
|
22279
21402
|
*/
|
|
22280
21403
|
fn.noCanvas = function () {
|
|
22281
21404
|
if (this.canvas) {
|
|
@@ -22324,8 +21447,6 @@ function rendering(p5, fn){
|
|
|
22324
21447
|
* @return {p5.Graphics} new graphics buffer.
|
|
22325
21448
|
*
|
|
22326
21449
|
* @example
|
|
22327
|
-
* <div>
|
|
22328
|
-
* <code>
|
|
22329
21450
|
* // Double-click to draw the contents of the graphics buffer.
|
|
22330
21451
|
*
|
|
22331
21452
|
* let pg;
|
|
@@ -22351,11 +21472,8 @@ function rendering(p5, fn){
|
|
|
22351
21472
|
* image(pg, 25, 25);
|
|
22352
21473
|
* }
|
|
22353
21474
|
* }
|
|
22354
|
-
* </code>
|
|
22355
|
-
* </div>
|
|
22356
21475
|
*
|
|
22357
|
-
*
|
|
22358
|
-
* <code>
|
|
21476
|
+
* @example
|
|
22359
21477
|
* // Double-click to draw the contents of the graphics buffer.
|
|
22360
21478
|
*
|
|
22361
21479
|
* let pg;
|
|
@@ -22385,8 +21503,6 @@ function rendering(p5, fn){
|
|
|
22385
21503
|
* image(pg, 25, 25);
|
|
22386
21504
|
* }
|
|
22387
21505
|
* }
|
|
22388
|
-
* </code>
|
|
22389
|
-
* </div>
|
|
22390
21506
|
*/
|
|
22391
21507
|
/**
|
|
22392
21508
|
* @method createGraphics
|
|
@@ -22450,8 +21566,6 @@ function rendering(p5, fn){
|
|
|
22450
21566
|
* @return {p5.Framebuffer} new framebuffer.
|
|
22451
21567
|
*
|
|
22452
21568
|
* @example
|
|
22453
|
-
* <div>
|
|
22454
|
-
* <code>
|
|
22455
21569
|
* let myBuffer;
|
|
22456
21570
|
*
|
|
22457
21571
|
* function setup() {
|
|
@@ -22497,11 +21611,8 @@ function rendering(p5, fn){
|
|
|
22497
21611
|
* }
|
|
22498
21612
|
* }
|
|
22499
21613
|
* }
|
|
22500
|
-
* </code>
|
|
22501
|
-
* </div>
|
|
22502
21614
|
*
|
|
22503
|
-
*
|
|
22504
|
-
* <code>
|
|
21615
|
+
* @example
|
|
22505
21616
|
* let myBuffer;
|
|
22506
21617
|
*
|
|
22507
21618
|
* function setup() {
|
|
@@ -22551,8 +21662,6 @@ function rendering(p5, fn){
|
|
|
22551
21662
|
* }
|
|
22552
21663
|
* }
|
|
22553
21664
|
* }
|
|
22554
|
-
* </code>
|
|
22555
|
-
* </div>
|
|
22556
21665
|
*/
|
|
22557
21666
|
fn.createFramebuffer = function (options) {
|
|
22558
21667
|
return new Framebuffer(this._renderer, options);
|
|
@@ -22581,8 +21690,6 @@ function rendering(p5, fn){
|
|
|
22581
21690
|
* (none) and 1 (far clipping plane). Defaults to 1.
|
|
22582
21691
|
*
|
|
22583
21692
|
* @example
|
|
22584
|
-
* <div>
|
|
22585
|
-
* <code>
|
|
22586
21693
|
* let previous;
|
|
22587
21694
|
* let current;
|
|
22588
21695
|
*
|
|
@@ -22635,8 +21742,6 @@ function rendering(p5, fn){
|
|
|
22635
21742
|
* // Display the current p5.Framebuffer.
|
|
22636
21743
|
* image(current, -50, -50);
|
|
22637
21744
|
* }
|
|
22638
|
-
* </code>
|
|
22639
|
-
* </div>
|
|
22640
21745
|
*/
|
|
22641
21746
|
fn.clearDepth = function (depth) {
|
|
22642
21747
|
this._assert3d('clearDepth');
|
|
@@ -22656,8 +21761,6 @@ function rendering(p5, fn){
|
|
|
22656
21761
|
* @property {CanvasRenderingContext2D|WebGLRenderingContext|WebGL2RenderingContext} drawingContext
|
|
22657
21762
|
*
|
|
22658
21763
|
* @example
|
|
22659
|
-
* <div>
|
|
22660
|
-
* <code>
|
|
22661
21764
|
* function setup() {
|
|
22662
21765
|
* createCanvas(100, 100);
|
|
22663
21766
|
*
|
|
@@ -22674,11 +21777,8 @@ function rendering(p5, fn){
|
|
|
22674
21777
|
*
|
|
22675
21778
|
* describe("A white circle on a gray background. The circle's edges are shadowy.");
|
|
22676
21779
|
* }
|
|
22677
|
-
* </code>
|
|
22678
|
-
* </div>
|
|
22679
21780
|
*
|
|
22680
|
-
*
|
|
22681
|
-
* <code>
|
|
21781
|
+
* @example
|
|
22682
21782
|
* function setup() {
|
|
22683
21783
|
* createCanvas(100, 100);
|
|
22684
21784
|
*
|
|
@@ -22697,8 +21797,6 @@ function rendering(p5, fn){
|
|
|
22697
21797
|
*
|
|
22698
21798
|
* describe('A fiery sun drawn on a light blue background.');
|
|
22699
21799
|
* }
|
|
22700
|
-
* </code>
|
|
22701
|
-
* </div>
|
|
22702
21800
|
*/
|
|
22703
21801
|
}
|
|
22704
21802
|
|