Skip to content

Commit

Permalink
Merge pull request #2968 from TanviKumar/test-io
Browse files Browse the repository at this point in the history
Change loadModel() example
  • Loading branch information
kjhollen authored Jul 6, 2018
2 parents c6d66c1 + 5e00665 commit 342d0f4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
16 changes: 16 additions & 0 deletions docs/yuidoc-p5-theme/assets/octahedron.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
v 0.000000E+00 0.000000E+00 40.0000
v 22.5000 22.5000 0.000000E+00
v 22.5000 -22.5000 0.000000E+00
v -22.5000 -22.5000 0.000000E+00
v -22.5000 22.5000 0.000000E+00
v 0.000000E+00 0.000000E+00 -40.0000

f 1 2 3
f 1 3 4
f 1 4 5
f 1 5 2
f 6 5 4
f 6 4 3
f 6 3 2
f 6 2 1
f 6 1 5
31 changes: 30 additions & 1 deletion src/webgl/loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,38 @@ require('./p5.Geometry');
* @example
* <div>
* <code>
* //draw a spinning octahedron
* var octahedron;
*
* function preload() {
* octahedron = loadModel('assets/octahedron.obj');
* }
*
* function setup() {
* createCanvas(100, 100, WEBGL);
* }
*
* function draw() {
* background(200);
* rotateX(frameCount * 0.01);
* rotateY(frameCount * 0.01);
* model(octahedron);
* }
* </code>
* </div>
*
* @alt
* Vertically rotating 3-d octahedron.
*
* @example
* <div>
* <code>
* //draw a spinning teapot
* var teapot;
*
* function preload() {
* teapot = loadModel('assets/teapot.obj');
* // Load model with normalise parameter set to true
* teapot = loadModel('assets/teapot.obj', true);
* }
*
* function setup() {
Expand All @@ -48,8 +75,10 @@ require('./p5.Geometry');
*
* function draw() {
* background(200);
* scale(0.4); // Scaled to make model fit into canvas
* rotateX(frameCount * 0.01);
* rotateY(frameCount * 0.01);
* normalMaterial(); // For effect
* model(teapot);
* }
* </code>
Expand Down

0 comments on commit 342d0f4

Please sign in to comment.