@@ -391,18 +391,12 @@ learn:
391
391
与迄今为止描述的其他方法一样,它接受x、y和z值的参数。
392
392
getting-started-in-webgl-coords-and-transform-heading4 : 变换的顺序很重要!
393
393
getting-started-in-webgl-coords-and-transform-p13x1 : >-
394
- Something that can feel unpredictable at first is the order of
395
- transformations. Each transformation always affects the next one. For
396
- example, if <a class="code">rotate()</a> is called, followed by <a
397
- class="code">translate()</a>, the direction of that translation will be
398
- affected by the rotation. The entire coordinate system is rotating and
399
- moving, not just the shape itself.
394
+ 一开始可能感觉难以预测的是变换的顺序。每个变换都会影响下一个变换。例如,如果调用 <a class="code">rotate()</a>,然后是 <a
395
+ class="code">translate()</a>,那么该平移的方向将受到旋转的影响。整个坐标系在旋转和移动,不仅仅是形状本身。
396
+
400
397
getting-started-in-webgl-coords-and-transform-p14x1 : >-
401
- Transformations can be performed in any order, but using
402
- <strong>translate</strong>, <strong>rotate</strong>, and then
403
- <strong>scale</strong> will be the most intuitive. Translation, followed by
404
- rotation, produces the effect of moving the shape <em>and then</em> rotating
405
- around that new location.
398
+ 变换可以以任何顺序执行,但是使用<strong>translate</strong>、<strong>rotate</strong>,然后<strong>scale</strong>会是最直观的。
399
+ 先进行平移,然后进行旋转,产生将形状移动到新位置并围绕该位置旋转的效果。
406
400
getting-started-in-webgl-coords-and-transform-p15x1 : >-
407
401
在下面的例子中,尝试改变<a class="code">translate()</a>和<a class="code">rotateY()</a>的顺序,看看它如何影响对象的绘制位置。
408
402
@@ -448,13 +442,10 @@ learn:
448
442
href="{{root}}/reference/#/p5/torus">torus()</a>。
449
443
getting-started-in-webgl-coords-and-transform-p20x2 : and
450
444
getting-started-in-webgl-coords-and-transform-p21x1 : >-
451
- It is also possible to create custom geometry, either from scratch or from
452
- 3D models created in another program. More information about custom geometry
453
- can be found the <a
454
- href="{{root}}/learn/getting-started-in-webgl-custom-geometry.html">Custom
455
- Geometry tutorial</a>.
456
- getting-started-in-webgl-coords-and-transform-p21x2 : ' Custom Geometry tutorial '
457
- getting-started-in-webgl-coords-and-transform-heading6 : Conclusion
445
+ 可以从头开始或从另一个程序创建的3D模型创建自定义几何体。有关自定义几何体的更多信息,请参阅
446
+ <a href="{{root}}/learn/getting-started-in-webgl-custom-geometry.html">自定义几何体教程</a>.
447
+ getting-started-in-webgl-coords-and-transform-p21x2 : ' 自定义几何体教程 '
448
+ getting-started-in-webgl-coords-and-transform-heading6 : 结论
458
449
getting-started-in-webgl-coords-and-transform-p22x1 : >-
459
450
By having basic control over a 3D coordinate space, transformations, and
460
451
basic shapes, you should be able to begin creating basic scenes in 3D. The
@@ -622,37 +613,23 @@ learn:
622
613
might appear to have a zoom-like effect, but it will change way that shapes
623
614
will change size in the distance.
624
615
getting-started-in-webgl-appearance-p4x1 : >-
625
- Another important term when working with cameras in 3D is the camera
626
- <em>frustum</em>. The frustum of the camera the shape of the camera's view,
627
- a pyramid-like shape within which geometry can be displayed. The frustum
628
- includes a <em>near and far plane</em>. The near plane defines the minimum
629
- distance that geometry must be from the camera to be rendered. The far plane
630
- defines the maximum distance that the geometry can be from the camera. Each
631
- of these can be changed to affect how close and how far the camera can see.
632
- This process of selectively including geometry is sometimes referred to as
633
- 'clipping'.
616
+ 在 3D 中使用相机时,另一个重要的术语是相机的视锥体<em>frustum</em>。
617
+ 相机的视锥体是相机视图的形状,一个金字塔形状,其中可以显示几何形状。视锥体包括<em>近平面和远平面</em>。
618
+ 近平面定义了几何形状与相机之间必须呈现的最小距离。远平面定义了几何形状与相机之间可以呈现的最大距离。
619
+ 每个平面都可以更改,以影响相机可以看到多近和多远。有时将这种有选择地包含几何形状的过程称为“裁剪”。
634
620
getting-started-in-webgl-appearance-p5x1 : >-
635
- Cameras can be moved by passing arguments to <a class="code">camera()</a>,
636
- but constantly moving and adjusting the camera in code can be tedious,
637
- especially when you are experimenting with ideas. p5.js has a special camera
638
- method, <a class="code"
639
- href="{{root}}/reference/#/p5/orbitControl">orbitControl()</a>, that can be used to zoom, pan,
640
- and position the camera using the mouse.
641
- getting-started-in-webgl-appearance-p5x2 : ' , that can be used to zoom, pan, and position the camera using the mouse.'
621
+ 相机可以通过向 <a class="code">camera()</a> 传递参数来移动,
622
+ 但在代码中不断移动和调整相机可能会很繁琐,特别是当你在尝试各种想法时。
623
+ p5.js 有一个特殊的相机方法 <a class="code"
624
+ href="{{root}}/reference/#/p5/orbitControl">orbitControl()</a>,可以使用鼠标缩放、平移和定位相机。
625
+ getting-started-in-webgl-appearance-p5x2 : ' 可以使用鼠标缩放、平移和定位相机。'
642
626
getting-started-in-webgl-appearance-p6x1 : >-
643
- A scene can have multiple cameras, but only one camera can be active at a
644
- time. Sketches in p5.js will default to having a single perspective camera,
645
- but that can be changed by calling either <a
646
- class="code">perspective()</a>
647
- (with new parameters) or <a class="code">ortho()</a>. <a
648
- class="code">camera()</a> can be used to change the position of the active
649
- camera and the position that the camera is looking at. Try it out in the
650
- sketch below.
651
- getting-started-in-webgl-appearance-heading2 : Lighting
627
+ 一个场景可以有多个相机,但一次只能有一个相机处于活动状态。
628
+ 在 p5.js 中,草图默认只有一个透视相机,但可以通过调用 <a class="code">perspective()</a>(使用新参数)或 <a class="code">ortho()</a> 来更改相机类型。
629
+ <a class="code">camera()</a> 可以用于更改活动相机的位置和相机所看向的位置。在下面的草图中试试吧。
630
+ getting-started-in-webgl-appearance-heading2 : 照明
652
631
getting-started-in-webgl-appearance-p7x1 : >-
653
- Lighting is another essential part of a 3D scene. To be able to convey shape
654
- and depth in 3D is necessary to have a light source. p5.js has a few
655
- different types of light that can be used in a sketch.
632
+ 照明是 3D 场景中的另一个重要组成部分。为了能够传达形状和深度,必须拥有光源。p5.js 中有一些不同类型的光源可供草图使用。
656
633
getting-started-in-webgl-appearance-lighting-list1 : >-
657
634
在场景中使用环境光会使得所有物体都显示得更亮,不考虑光源的位置或方向。
658
635
getting-started-in-webgl-appearance-lighting-list2 : >-
0 commit comments