Skip to content

Commit 0071a11

Browse files
trans
1 parent 800e8d4 commit 0071a11

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

src/data/zh-Hans.yml

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -708,33 +708,23 @@ learn:
708708
int // 不带小数点的整数
709709
sampler2D // 对纹理的引用
710710
getting-started-in-webgl-shaders-p5x1: >-
711-
In general the shading language is much more strict than JavaScript. A
712-
missing semicolon for example is not allowed and will result in an error
713-
message. You can't use different types of numbers, like floats or integers
714-
interchangeably.
715-
getting-started-in-webgl-shaders-p6x1: 'First let''s look at a basic vertex shader:'
711+
通常情况下,着色语言比 JavaScript 更加严格。例如,缺少分号将导致错误信息。
712+
不能在不同类型的数字之间进行交换,如浮点数或整数。
713+
getting-started-in-webgl-shaders-p6x1: '首先,让我们看一个基本的顶点着色器:'
716714
getting-started-in-webgl-shaders-p7x1: >-
717-
This vertex shader begins with an <em>attribute</em>, which p5.js uses to
718-
share vertex position information with the shader. This attribute is a <a
719-
class="code">vec3</a>, meaning it contains a value for x, y, and z.
720-
Attributes are special variable types that are only used in the vertex
721-
shader and are typically provided by p5.js.
715+
这个顶点着色器以一个 <em>attribute</em> 开始,p5.js 使用它来与着色器共享顶点位置信息。这个 attribute 是一个 <a
716+
class="code">vec3</a>,意味着它包含一个 x、y 和 z 值。
717+
Attributes 是特殊的变量类型,只在顶点着色器中使用,并且通常由 p5.js 提供。
722718
getting-started-in-webgl-shaders-p8x1: >-
723-
All vertex shaders require a function, <a class="code">main()</a>, within
724-
which we position our vertices. In this example, the vertex shader
725-
repositions our vertices so that the shader output takes up the full sketch.
726-
At the end of <a
727-
class="code">main()</a>,
728-
we have to assign a value to <a class="code">gl_Position</a>.
719+
所有顶点着色器都需要一个函数 <a class="code">main()</a>,在其中我们定位我们的顶点。
720+
在这个例子中,顶点着色器重新定位我们的顶点,使着色器输出占据整个画布。在 <a
721+
class="code">main()</a> 的末尾,我们必须给 <a class="code">gl_Position</a> 赋值。
729722
getting-started-in-webgl-shaders-p9x1: >-
730-
Don't worry if this doesn't make a ton of sense yet. The vertex shader plays
731-
an important role but it is often just responsible for making sure what we
732-
create in our fragment shader displays properly on the geometry. You'll
733-
probably find yourself reusing the same vertex shaders in many of your
734-
projects. The fragment shader on the other hand is responsible for the color
735-
output of our shader and is where we will do a lot of our shader
736-
programming. Here is a very simple fragment shader that will just display
737-
the color red:
723+
如果这还不是很清楚,也不要担心。顶点着色器起着重要的作用,
724+
但通常只负责确保我们在片段着色器中创建的内容在几何体上正确地显示。
725+
在许多项目中,您可能会发现自己反复使用相同的顶点着色器。
726+
另一方面,片段着色器负责着色器的颜色输出,是我们进行大量着色器编程的地方。
727+
以下是一个非常简单的片段着色器,它只会显示红色:
738728
getting-started-in-webgl-shaders-p10x1: >-
739729
The fragment shader begins with a line specifying the float 'precision'.
740730
this value you can either be lowp, mediump, or highp, although you will

0 commit comments

Comments
 (0)