Skip to content

Commit 35ad365

Browse files
authored
Merge pull request #7691 from perminder-17/patch-7
Updating loadModel function
2 parents adccde9 + 82d0ab6 commit 35ad365

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/image/loading_displaying.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ function loadingDisplaying(p5, fn){
6666
*
6767
* <div>
6868
* <code>
69-
* function setup() {
69+
* async function setup() {
7070
* // Call handleImage() once the image loads.
71-
* loadImage('assets/laDefense.jpg', handleImage);
71+
* await loadImage('assets/laDefense.jpg', handleImage);
7272
*
7373
* describe('Image of the underside of a white umbrella and a gridded ceiling.');
7474
* }
@@ -82,10 +82,10 @@ function loadingDisplaying(p5, fn){
8282
*
8383
* <div>
8484
* <code>
85-
* function setup() {
85+
* async function setup() {
8686
* // Call handleImage() once the image loads or
8787
* // call handleError() if an error occurs.
88-
* loadImage('assets/laDefense.jpg', handleImage, handleError);
88+
* await loadImage('assets/laDefense.jpg', handleImage, handleError);
8989
* }
9090
*
9191
* // Display the image.
@@ -995,7 +995,7 @@ function loadingDisplaying(p5, fn){
995995
*
996996
* async function setup() {
997997
* // Load the image.
998-
* img = await loadImage('assets/laDefense50.jpg');
998+
* img = await loadImage('assets/laDefense50.png');
999999
*
10001000
* createCanvas(100, 100);
10011001
*

src/webgl/loading.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ function loading(p5, fn){
9898
*
9999
* @method loadModel
100100
* @param {String|Request} path path of the model to be loaded.
101+
* @param {String} [fileType] model’s file extension. Either `'.obj'` or `'.stl'`.
101102
* @param {Boolean} normalize if `true`, scale the model to fit the canvas.
102103
* @param {function(p5.Geometry)} [successCallback] function to call once the model is loaded. Will be passed
103104
* the <a href="#/p5.Geometry">p5.Geometry</a> object.
104105
* @param {function(Event)} [failureCallback] function to call if the model fails to load. Will be passed an `Error` event object.
105-
* @param {String} [fileType] model’s file extension. Either `'.obj'` or `'.stl'`.
106106
* @return {Promise<p5.Geometry>} the <a href="#/p5.Geometry">p5.Geometry</a> object
107107
*
108108
* @example
@@ -168,8 +168,8 @@ function loading(p5, fn){
168168
* let shape;
169169
*
170170
* // Load the file and create a p5.Geometry object.
171-
* function setup() {
172-
* loadModel('assets/teapot.obj', true, handleModel);
171+
* async function setup() {
172+
* await loadModel('assets/teapot.obj', true, handleModel);
173173
*
174174
* createCanvas(100, 100, WEBGL);
175175
*
@@ -202,8 +202,8 @@ function loading(p5, fn){
202202
* let shape;
203203
*
204204
* // Load the file and create a p5.Geometry object.
205-
* function setup() {
206-
* loadModel('assets/wrong.obj', true, handleModel, handleError);
205+
* async function setup() {
206+
* await loadModel('assets/teapot.obj', true, handleModel, handleError);
207207
*
208208
* createCanvas(100, 100, WEBGL);
209209
*
@@ -241,8 +241,8 @@ function loading(p5, fn){
241241
* let shape;
242242
*
243243
* // Load the file and create a p5.Geometry object.
244-
* function setup() {
245-
* loadModel('assets/teapot.obj', true, handleModel, handleError, '.obj');
244+
* async function setup() {
245+
* await loadModel('assets/teapot.obj', '.obj', true, handleModel, handleError);
246246
*
247247
* createCanvas(100, 100, WEBGL);
248248
*
@@ -279,15 +279,15 @@ function loading(p5, fn){
279279
*
280280
* let shape;
281281
* let options = {
282+
* fileType: '.obj',
282283
* normalize: true,
283284
* successCallback: handleModel,
284-
* failureCallback: handleError,
285-
* fileType: '.obj'
285+
* failureCallback: handleError
286286
* };
287287
*
288288
* // Load the file and create a p5.Geometry object.
289-
* function setup() {
290-
* loadModel('assets/teapot.obj', options);
289+
* async function setup() {
290+
* await loadModel('assets/teapot.obj', options);
291291
*
292292
* createCanvas(100, 100, WEBGL);
293293
*
@@ -321,18 +321,18 @@ function loading(p5, fn){
321321
/**
322322
* @method loadModel
323323
* @param {String|Request} path
324+
* @param {String} [fileType]
324325
* @param {function(p5.Geometry)} [successCallback]
325326
* @param {function(Event)} [failureCallback]
326-
* @param {String} [fileType]
327327
* @return {Promise<p5.Geometry>} new <a href="#/p5.Geometry">p5.Geometry</a> object.
328328
*/
329329
/**
330330
* @method loadModel
331331
* @param {String|Request} path
332332
* @param {Object} [options] loading options.
333+
* @param {String} [options.fileType]
333334
* @param {function(p5.Geometry)} [options.successCallback]
334335
* @param {function(Event)} [options.failureCallback]
335-
* @param {String} [options.fileType]
336336
* @param {Boolean} [options.normalize]
337337
* @param {Boolean} [options.flipU]
338338
* @param {Boolean} [options.flipV]

0 commit comments

Comments
 (0)