You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p><aclass="code"href="{{root}}/reference/#/p5/scale">scale()</a> changes the size of whatever is
209
-
drawn after it. </p>
203
+
drawn after it. Like the other methods described so far, it accepts arguments for x, y, and z values.</p>
210
204
211
205
<h2id="order">Order</h2>
212
206
213
207
<p>Something that can feel unpredictable at first is the order of transformations. Each transformation can affect
214
-
the next one. For example if you call rotate(), followed by translate(), the direction of that translation will
215
-
be affected by the rotation. You can think of it as your entire coordinate system rotating and moving, not just
216
-
the object itself.</p>
217
-
218
-
<p>The order that you use will depend on what you’re trying to do, but a good place to start is to follow the
219
-
order of <strong>translate</strong>, <strong>rotate</strong>, and then <strong>scale</strong>. If you perform
220
-
these out of order you might find that your
221
-
transformations don’t act the way that you expect them to.
208
+
the next one. For example, if <aclass="code">rotate()</a> is called, followed by <aclass="code">translate()</a>, the direction of that translation will
209
+
be affected by the rotation. The entire coordinate system is rotating and moving, not just the shape itself.
222
210
</p>
223
211
212
+
<p>Transformations can be performed in any order, but using <strong>translate</strong>, <strong>rotate</strong>, and then <strong>scale</strong> will be the most intuitive.</p>
213
+
224
214
<p>In the below example, try changing the order of <aclass="code">translate()</a> and <a
225
215
class="code">rotateY()</a> and see how it affects where the object is
Copy file name to clipboardExpand all lines: src/templates/pages/learn/getting-started-in-webgl-custom-geometry.hbs
+10-27Lines changed: 10 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -45,14 +45,13 @@ slug: learn/
45
45
46
46
<h1>Creating Custom Geometry in WebGL</h1>
47
47
48
-
<p>p5.js has a number of 3D primitives that can be used to create basic shapes, like box() or sphere(), but p5.js
48
+
<p>p5.js has a number of 3D primitives that can be used to create basic shapes, like <aclass="code">box()</a> or <aclass="code">sphere()</a>, but p5.js
49
49
is also capable of rendering complex custom geometry, either from files that are created in other 3D software
50
50
(like Blender) or from code. This tutorial will walk through how to import 3D models into p5.js, as well as how
51
51
to create a basic geometry from scratch. </p>
52
52
53
53
<divclass="additionalInformation">If you are new to 3D it's recommended that you check out the <a
54
-
href="{{root}}/learn/getting-started-in-webgl-coords-and-transform.html">Getting Started
55
-
With 3D</a> tutorial before continuing with this tutorial. </div>
54
+
href="{{root}}/learn/getting-started-in-webgl-coords-and-transform.html">Coordinates and Transformations</a> tutorial before continuing with this tutorial. </div>
56
55
57
56
<divclass="toc">
58
57
<h3>Table of Contents</h3>
@@ -67,11 +66,11 @@ slug: learn/
67
66
68
67
<p>Custom geometry can be imported into p5.js using either OBJ or STL files. These files are usually generated in
69
68
a 3D modeling tool like Blender, which offers much more control when constructing a 3D scene. This is done using
70
-
the loadModel method, which should be used within preload().</p>
69
+
the <aclass="code"href="{{root}}/reference/#/p5/loadModel">loadModel()</a> method, which should be used within <aclass="code">preload()</a>.</p>
71
70
72
71
<p>A common issue that can come up with custom models is scaling. Depending on how the model is constructed, it
73
72
might be a much different size when rendered in p5.js, or even be too small to be rendered at all. The
74
-
loadModel() method includes a normalize parameter that will resize the model to something that works better in
73
+
<aclass="code">loadModel()</a> method includes a normalize parameter that will resize the model to something that works better in
75
74
p5.js.</p>
76
75
77
76
{{!-- Widget example of teapot model and loadModel --}}
@@ -95,33 +94,19 @@ function draw(){
95
94
</script>
96
95
97
96
<divclass="additionalInformation">Note that there is currently no support for STL files with color, although you
98
-
can add color using materials or textures, which you can learn about in the (LINKED NAME OF MATERIAL TUTORIAL).
97
+
can add color using materials or textures, which you can learn about in the <ahref="{{root}}/learn/getting-started-in-webgl-appearance.html">Styling and Appearance</a> tutorial.
0 commit comments